in reply to Re: Windows 98: track the current user's idle time
in thread Windows 98: track the current user's idle time

Reading that again, it does look messy. There are a lot of functions to import and some structures are involved as well! Ugh! It first looked like you want SetWindowsHookEx in User32.lib according to the bottom of the MSDN page if you were going by the CodeProject article. MSDN usually lists header files and libraries at the bottom of these pages, along with the applicable versions of Windows.

I will say, from reading the article again, this is implementing a timer and using some callbacks, which is going to get really ugly FAST. I'm sorry, but my help now isn't helping any more either.

Did I tell you how much I hated Microsoft API's?

We know this is possible (at least using undocumented API's) since Windows screensavers do this. Can I ask why you are trying to get this info? It might be possible to do something sneaky like (DARE I SAY IT?) find some Windows screensaver source on the internet, and install your program as a screensaver (using pure C++ code) embedding a Perl interpreter when neccessary? Do you enjoy pain?

The last bit of brainstorming I have is to just check the mouse position and snoop on the keyboard, but I have no idea exactly how that is possible either without a huge performance drain. It _really_ sounds like you want to register for callbacks or to find a way to query this info -- but where?

  • Comment on Re: Re: Windows 98: track the current user's idle time

Replies are listed 'Best First'.
Re: Re: Re: Windows 98: track the current user's idle time
by bart (Canon) on Mar 24, 2004 at 01:24 UTC
    We know this is possible (at least using undocumented API's) since Windows screensavers do this.
    No they don't. Screensavers are launched by the system. So it's the system that keeps track of user activity.

    And they just check their Windows messages, just like any normal Windows app, to detect if there's any mouse or keyboard activity, to know when to exit.

      No they don't. Screensavers are launched by the system. So it's the system that keeps track of user activity.

      I know this.... The screensaver doesn't know idle time, but the system that LAUNCHES the screensavers knows the idle time. Hence if you make your application into a screensaver (oh, the pain), you could be launched at a certain point in time... but man, that would be quite annoying work :)