Bill
You wrote in message news:bb2gsi$4sjte$
[hidden email]...
>
> What's the best way to detect that the user has done something? I need to
> create some kind of "locking screen saver", and envision a background
thread
> that sleeps most of the time, and when it wakes with no time left on the
> count down, it posts an action to lock the app. Obviously, I don't want
> normal system activity to be misinterpreted as user activity, nor do I
want
> to have to trigger/handle events from every aspect of the models involved.
>
> Any ideas?
If you know you'll not have to run on Win9x, there is a very handy function
called GetLastInputInfo (added in Win2K) that should do exactly what you
want if called every now and then from a background thread:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/userinput/keyboardinput/keyboardinputreference/keyboardinputfunctions/getlastinputinfo.aspThe help even mentions that the function "is useful for input idle
detection".
Another possibility is to modify InputState to record the last time a user
input message (keyboard or mouse) was received. All input is pumped through
the message loop, so this would be possible. However I think the overhead
might be high.
Other than that I think you will have to do a bit of web research to locate
some code, though it'll probably be for VB.
Regards
Blair