idletime.dll
idletime.dll is a 3 kB dll that you can use with your programs to check for how long a user has been idle. It exports the following functions -
UINT GetIdleTime(void); BOOL SetCallback(HWND hWnd, MSG uMsg, UINT nElapseTime);
GetIdleTime() can be used to retrieving the time for which the user has not touched the mouse or the keyboard while SetCallback sends your application a message (uMsg) after nElapseTime idle time.