System Power Status

The system power status indicates whether the source of power for a computer is a system battery or AC power. For computers that use batteries, the system power status also indicates how much battery life remains and whether the battery is charging.

Power information is retrieved by registering for power setting notifications through the RegisterPowerSettingNotification function. This function allows applications to register for specific power settings and be notified when they change.

Note  To query for power status information without notifications, use CallNtPowerInformation.

Applications and installable drivers typically use the system power status to determine whether continued operation is feasible. For example, before an application performs background operations such as compressing or paginating a file, it should check whether the system is on batteries. As another example, an application that is beginning a lengthy operation should check the status to determine whether enough battery power exists to complete the operation.

By default, the system does not query applications or drivers during sleep transitions.

Note  If power is low, an application can request user intervention or request that the system suspend itself. You can suspend system operation by using the SetSuspendState function.

Related topics

About Power Management