Group: Power Management - Library: kernel32
Enables applications to inform the system that it is in use, thereby preventing the system from entering the sleeping power state or turning off the display while the application is running.
How to suspend or hibernate your system
EXECUTION_STATE SetThreadExecutionState(
EXECUTION_STATE esFlags
);
DECLARE INTEGER SetThreadExecutionState IN kernel32;
INTEGER esFlags
esFlags [in] Execution requirements for the thread.
If the function succeeds, the return value is the previous thread execution state. If the function fails, the return value is NULL.
To run properly on a power-managed computer, applications such as fax servers, answering machines, backup agents, and network management applications must use ES_SYSTEM_REQUIRED | ES_CONTINUOUS when they process events.
Multimedia applications, such as video players and presentation applications, must use ES_DISPLAY_REQUIRED when they display video for long periods of time without user input. Applications such as word processors, spreadsheets, browsers, and games do not need to call SetThreadExecutionState.