Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Programmatically reset Windows XP IDLE time

Windows resets the IDLE time every time the user touches the keyboard or the mouse. My application needs to reset the IDLE time at specific moments, but i can't figure out how to do this programmatically.

The following does NOT reset the IDLE time using VB, C# or QT4.
- Programmatic mouse movement / click.
- Programmatic keystroke.
Somehow Windows knows these actions are simulated.

How can i reset the IDLE time? Any thoughts will be greatly appreciated!

like image 326
Anne Avatar asked Feb 11 '11 00:02

Anne


1 Answers

Use SetThreadExecutionState(). The ES_SYSTEM_REQUIRED option (2) resets the system idle timer. Visit pinvoke.net for the required declarations.

like image 147
Hans Passant Avatar answered Sep 21 '22 07:09

Hans Passant