The system broadcasts a message to all applications and installable drivers whenever a power management event occurs. The system broadcasts these events through the WM_POWERBROADCAST message, setting the wParam parameter to the appropriate power management event. For example, the PBT_APMPOWERSTATUSCHANGE event indicates a system power status change. You must ensure that your application responds properly to the WM_POWERBROADCAST message.
The system broadcasts a PBT_APMSUSPEND event immediately before suspending operation. This gives applications and drivers one last chance to prepare for the event. In many cases, the system broadcasts these messages without requesting permission to do so. This happens, for example, if an application forces suspension with the SetSuspendState function.
The system broadcasts the PBT_APMRESUMESUSPEND or PBT_APMRESUMECRITICAL event when system operation has been restored. If an application received a PBT_APMSUSPEND event before the computer was suspended, it will receive the PBT_APMRESUMESUSPEND event. Otherwise, it will receive the PBT_APMRESUMECRITICAL event.
The system sends a PBT_POWERSETTINGCHANGE event to applications that have registered for the specific event using RegisterPowerSettingNotification. For more information, see Registering for Power Events.