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.
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]