Notifies applications that a power-management event has occurred.
A window receives this message through its WindowProc function.
LRESULT CALLBACK WindowProc( HWND hwnd, // handle to window UINT uMsg, // WM_POWERBROADCAST WPARAM wParam, // power-management event LPARAM lParam // function-specific data );
A handle to window.
- 536 (0x218)
The power-management event. This parameter can be one of the following event identifiers.
- 10 (0xA)
Power status has changed.
- 18 (0x12)
Operation is resuming automatically from a low-power state. This message is sent every time the system resumes.
- 7 (0x7)
Operation is resuming from a low-power state. This message is sent after PBT_APMRESUMEAUTOMATIC if the resume is triggered by user input, such as pressing a key.
- 4 (0x4)
System is suspending operation.
- 32787 (0x8013)
A power setting change event has been received.
Windows Server 2003: The following event identifiers are also supported.
- 9 (0x9)
Battery power is low. In Windows Server 2008 and Windows Vista, use PBT_APMPOWERSTATUSCHANGE instead.
- 11 (0xB)
OEM-defined event occurred. In Windows Server 2008 and Windows Vista, this event is not available because these operating systems support only ACPI; APM BIOS events are not supported.
- 0 (0x0)
Request for permission to suspend. In Windows Server 2008 and Windows Vista, use the SetThreadExecutionState function instead.
- 2 (0x2)
Suspension request denied. In Windows Server 2008 and Windows Vista, use SetThreadExecutionState instead.
- 6 (0x6)
Operation resuming after critical suspension. In Windows Server 2008 and Windows Vista, use PBT_APMRESUMEAUTOMATIC instead.
The event-specific data. For most events, this parameter is reserved and not used.
An application should return TRUE if it processes this message.
The system always sends a PBT_APMRESUMEAUTOMATIC message whenever the system resumes. If the system resumes in response to user input such as pressing a key, the system also sends a PBT_APMRESUMESUSPEND message after sending PBT_APMRESUMEAUTOMATIC.
WM_POWERBROADCAST messages do not distinguish between different low-power states. An application can determine only that the system is entering or has resumed from a low-power state; it cannot determine the specific power state. The system records details about power state transitions in the Windows System event log.
To prevent the system from transitioning to a low-power state in Windows Vista, an application must call SetThreadExecutionState to inform the system that it is in use.
The following messages are not supported on any of the operating systems specified in the Requirements section:
Minimum supported client
|Windows XP [desktop apps only]|
Minimum supported server
|Windows Server 2003 [desktop apps only]|