A power management event is a change in either the system power status or the operational mode of a device or the computer. Because these events can affect the operation of applications and installable drivers and can lead to loss of data, Windows notifies all applications and installable drivers by broadcasting a WM_POWERBROADCAST message for each event.
A system power status event occurs when there is a change in the power supply or in the system battery status. For example, the system broadcasts a message whenever the user switches from battery to AC power or vice versa. The system also broadcasts a message when remaining battery power slips below 10%.
An operational mode event occurs when there is a change in power consumption, such as the system shutting itself down or the user turning the system back on. Some changes in operational mode can cause loss of data if applications and drivers do not prepare for them. Therefore, the system broadcasts messages about these changes before they actually occur. For example, if the system determines that it is idle, it broadcasts a message notifying applications and drivers that it is about to suspend operation and shut itself down to save power. The applications and drivers can prepare for this suspension by closing files and saving data that may otherwise be lost when power is shut off.
The system has two ways to shut itself down. It can suspend operation or carry out critical suspension. An application can also shut the system down by using the SetSystemPowerState function to suspend operation.
When system operation is suspended, power to all devices is lost. The WM_POWERBROADCAST messages, sent immediately before suspension, allow device drivers to save the state of the device. For many devices (but not all), saving the state means the driver can restore the state when power is eventually restored, allowing the device to continue operation as if power was never lost.
When the system carries out a critical suspension, battery power is too low to let the computer continue to run. Unlike for suspended operation, the system does not notify applications and drivers before carrying out a critical suspension. This means data may be lost.
When system operation is restored after having been suspended, the system notifies all applications and drivers. It also identifies how the system was previously shut down so that the application or driver can take appropriate steps to restore its data and continue its own operation.