Windows 8 introduced a new power saving mode called connected standby. In Windows 10, this was extended and re-named "modern" standby". Some Microsoft documents refer to it as “S0 low-power idle mode” or "Always On / Always Connected". The new mode was initially used on the Microsoft Surface range and subsequently seems to be becoming more comment on other high-end laptop such as the Dell XPS.
Traditionally, desktop apps could use the SetSuspendState()
to suspend (S1-S3) or hibernate (S4) the PC. However, this no longer works on modern standby systems and will fails with ERROR_NOT_SUPPORTED
. A workaround is to turn off the display directly:
SendMessage(HWND_BROADCAST, WM_SYSCOMMAND, SC_MONITORPOWER, (LPARAM) 2);
This works fine from normal user session, but can only be used from an application that has access to the display. It cannot be used in a service due to session 0 isolation.
How do you initiate "modern" standby from a service running in session 0?