Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Connected standby notification for a W8 Service

I have a service, developed in C++ running on Windows 8 (and 8.1). How can I get to know that the system has entered Connected Standby?

Since this is a service, it does not have a window, I should be using PowerRegisterSuspendResumeNotification, but it does not seem to be working. Does anyone know how I can get such a notification?

like image 373
Nezz Avatar asked Nov 21 '13 11:11

Nezz


People also ask

Is connected standby the same as sleep?

When a user punches a key or touches the screen, the device instantly becomes operational. Connected Standby differs from sleep mode in its ability to instantly transition between an off-screen standby to an on-screen online mode.

What is connected standby mode?

Connected Standby mode is primarily a device's battery operating mode on the Windows operating system. In this mode, the device is turned on, but the display will be dark. Windows suspends all applications that may be running and puts the device in a state that consumers minimal power.

How can you check if Modern Standby is available on a machine?

Open Command Prompt window, which can be done several ways, but typing "cmd" in the Taskbar search window will bring it up fast. Type "powercfg/a" and hit Enter and it will show you what sleep states your PC supports. If S0 Low Power Idle is listed as available, congratulations, you have Modern Standby.

How do you get on Modern Standby?

To initiate entry to Modern Standby, press the power button, close the lid, or select Sleep from the power button in the Settings flyout. These actions should instantly power off the display. To wake up the system, simply press the power button or open the lid of the system.


2 Answers

I have contacted Microsoft's technical support. This is their answer:

There are no direct notifications for ConnectedStandby enter/exit, but you can just use the monitor on/off notifications since ConnectedStandby is synonymous with screen off on an AOAC capable system (but is not on a legacy system, AOAC capability can be had by getting SystemPowerCapabilities using CallNtPowerInformation and looking at the AoAc value of the SYSTEM_POWER_CAPABILITIES struct).

To get monitor on/off notifications you can use RegisterPowerSettingNotification and use the GUID_MONITOR_POWER_ON power setting GUID.

Looks like there is only a workaround for this by listening to screen on/off events.

like image 153
Nezz Avatar answered Oct 02 '22 13:10

Nezz


This is excruciating unable to comment!!

CallNtPowerInformation(SystemPowerCapabilities, ...) will return SYSTEM_POWER_CAPABILITIES. It has an BOOLEAN member AoAc, if it is FALSE, your system does not support connected standby.

It worked for me on an Intel custom hardware(same as machines in market). AoAc = Always On Always Connected, Intel's preference.

like image 39
Logan Avatar answered Oct 02 '22 13:10

Logan