Original Post
I have this handy little tool I wrote that runs in the background and detects when my screen saver comes up. When that happens, it activates my away message on AIM, and when the screen saver stops, it removes my away message. However, I only recently discovered that it's causing my system clock to slow down. I never really noticed it since my clock synchronizes with the internet once a week, and the slow down isn't extreme. Anyways, what I'm doing is creating a 5 second timer with SetTimer(), and then sitting in the typical GetMessage() loop, waiting for messages so it doesn't eat up the CPU. Then, on WM_TIMER, I'm doing: Where pApp is a pointer to my application object. Anyways, if I open up my system clock and watch when the seconds tick off, there's a slight but noticeable delay every 5 seconds - it'll tick off 4 seconds, and the fifth second will take about 1.1 seconds or so. Does anyone know what could be causing this? Are Windows timers just really stupid? If so, is there a better way to go about doing this?
case WM_TIMER:
{
if(wparam == 0)
{
BOOL isScreenSaverRunning;
SystemParametersInfo(SPI_GETSCREENSAVERRUNNING, 0, &isScreenSaverRunning, 0);
if((pApp->wasScreenSaverRunning) && (!isScreenSaverRunning))
pApp->DeactivateAwayMessage();
else if((!pApp->wasScreenSaverRunning) && (isScreenSaverRunning))
pApp->ActivateAwayMessage();
pApp->wasScreenSaverRunning = isScreenSaverRunning;
return 0;
}
break;
}