使用SetThreadExecutionState阻止系统进入睡眠状态或程序运行时关闭显示器
2023-08-01
57
0
Windows电源管理相关编程
// Television recording is beginning. Enable away mode and prevent
// the sleep idle time-out.
//
SetThreadExecutionState(ES_CONTINUOUS | ES_SYSTEM_REQUIRED | ES_AWAYMODE_REQUIRED);
//
// Wait until recording is complete...
//
//
// Clear EXECUTION_STATE flags to disable away mode and allow the system to idle to sleep normally.
//
SetThreadExecutionState(ES_CONTINUOUS);