System power status indicates the source of power for a computer, that is, whether it uses a system battery or AC power. For computers that use batteries, the status also indicates how much battery life remains and whether the battery is currently charging.
You can retrieve the system power status by using the GetSystemPowerStatus function. This copies information about the power supply and battery status to a SYSTEM_POWER_STATUS structure. This structure identifies whether the system has a battery, and if it does, whether the battery is being used and the percentage of charge remaining.
Applications and installable drivers typically use the system power status to make decisions about whether to continue operation. For example, an application that is beginning a lengthy operation may check the status to determine whether enough battery power exists to complete the operation.
If power is low, an application can request user intervention or request that the system to shut itself down. You can suspend the operation of the system by using the SetSystemPowerState function. This generates a power management event that, if approved by all applications and drivers in the system, shuts the system down until the user restores power. Even if a computer uses AC power, an application that determines that the system is idle and can request that the system shut itself down to save power.