Detecting idle time from a .Net application

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I'm having a lot of trouble finding a universal and stable solution to the
problem of detecting a session's idle time. I have a .Net application that
runs in the system tray, much like many of the messenger services out there.
From what I've read in the newsgroups, there are several mechanisms that I
can try, but the biggest problem is that I have to get it working on Win98,
WinME, Win2K and WinXP.

The options I've found are:

1) On a timer, use GetLastInputInfo to check the last input event

No good. This requires Win2K and up - I need to run on 98 and ME

2) Add a low-level mouse and keyboard hook in my .Net application using
SetWindowsHookEx specifying the hooks WH_MOUSE_LL and WH_KEYBOARD_LL

Again, works great in XP, but WH_MOUSE_LL and WH_KEYBOARD_LL are
incompatible with 98 andME

3) Add a global mouse and keyboard hook in an external DLL using
SetWindowHookEx and WH_MOUSE and WH_KEYBOARD

This work fine accross all platforms, but for some reason whenever the
screensaver kicks in, my hook stops receiving events.

So my question is, is there another solution I should try, or is there
something I should be aware of that could get any of the above solutions to
work?
 
So my question is, is there another solution I should try, or is there
something I should be aware of that could get any of the above solutions to
work?

Would the Application.Idle event help you?

--
Chris

dunawayc[AT]sbcglobal_lunchmeat_[DOT]net

To send me an E-mail, remove the "[", "]", underscores ,lunchmeat, and
replace certain words in my E-Mail address.
 
Back
Top