I want to track how long i been away from my keyboard/how long i took a break. I figure tracking my keyboard and mouse is a good way to see when i left and arrived. Whats the best way to track this? Some options i see
- Have a system wide callback for every mouse and keyboard press.
- Sleep for a 100ms and see if there is a keydown or mousemovent
- Use a system call that actually tells me when the last userinput was and use a combo of the above for efficiently. (sleep until user is away, then use callback to track arrival)
From stackoverflow
-
Try looking at this.
You shouldn't need to do the tracking yourself, it looks like you can do system calls to get the idle time.
Keltex : I would include some code. Makes the answer nicer!acidzombie24 : no need, i checked it out and it answers 2 & 3. The other answer solves 1) -
http://www.geekpedia.com/tutorial210%5FRetrieving-the-Operating-System-Idle-Time-Uptime-and-Last-Input-Time.html might also help you
bit late :P :P
0 comments:
Post a Comment