Timing last user input
Posted on 2003-03-07
I need to implement a background processing thread in my Windows app. The thread should “wake up” one hour after the last user interface activity, and run some time-consuming maintenance functions, like file backups. The idea behind one hour is to activate the thread when the app is not actively used.
How can I detect that there was no user interface activity for a certain period of time? Inserting some checkpoints into the user input functions (like OnMouseMove or OnKeydown) is hardly an option, since there is a lot of interface-related functions in my app. Is there a more elegant way to do it?