Detecting system idleness
Posted on 2006-07-21
In C#, how do I do the following:
I need to popup a certain window and play a sound when some event occurs. And this should happen ONLY when the user is actively using the system. One idea is to listen for mouse or keyboard events and decide based on when it was last moved / pressed. In this case, I might probably catch the cases where the user is logged on but not using the system at all (for example if the screensaver is running). But I'll not be able to detect the case when the PC is locked by the user (the user might lock his windows account with ctrl-alt-del and still move his mouse... in this case, hes not actually looking at his desktop so this is not the right time for my window to popup).
Can someone tell me the best way to check system idleness?