1

Earlier, when we call SetThreadExecutionState(ES_SYSTEM_REQUIRED) without ES_CONTINUOUS, it reset the system idle timer. But in Windows 11, that doesn't work anymore.

I need the reset the idle timer, and I wonder, how can I do it now?

Remy Lebeau
  • 555,201
  • 31
  • 458
  • 770
Anton111111
  • 656
  • 1
  • 7
  • 23
  • Just read the manual carefully. It worked in Windows 10 occasionally. *applications must use both ES_SYSTEM_REQUIRED and ES_CONTINUOUS* – 273K Apr 29 '23 at 16:31
  • I've done it with ES_SYSTEM_REQUIRED | ES_CONTINUOUS. But i want to reset timer after i clear flags ( SetThreadExecutionState(ES_CONTINUOUS)). Now when i call SetThreadExecutionState(ES_CONTINUOUS) pc sleep immediately – Anton111111 Apr 30 '23 at 08:33

1 Answers1

-2

According to the Doc:System Sleep Criteria

To maintain the time since the last user input, the system uses a display idle timer and a system idle timer. The system compares the idle timers to the values configured in the power plan. If the display idle timer value is greater than the display time-out value, and no threads have requested the display by calling SetThreadExecutionState with ES_DISPLAY_REQUIRED, the system powers off the display. Similarly, if the system idle timer is greater than the system time-out value and no applications have requested the system by calling SetThreadExecutionState with ES_SYSTEM_REQUIRED, the system enters sleep.

When you clear ES_SYSTEM_REQUIRED flag, will allow the system to idle to sleep normally. If the system idle timer is greater than the system time-out value and without ES_SYSTEM_REQUIRED flag, the system enters sleep.

Jeaninez - MSFT
  • 3,210
  • 1
  • 5
  • 20