PBT_APMSUSPEND event
Notifies applications that the computer is about to enter a suspended state. This event is typically broadcast when all applications and installable drivers have returned TRUE to a previous PBT_APMQUERYSUSPEND event.
A window receives this event through the WM_POWERBROADCAST message. The wParam and lParam parameters are set as described following.
LRESULT CALLBACK WindowProc( HWND hwnd, // handle to window UINT uMsg, // WM_POWERBROADCAST WPARAM wParam, // PBT_APMSUSPEND LPARAM lParam); // zero
Parameters
- hwnd
-
A handle to window.
- uMsg
-
Value Meaning - WM_POWERBROADCAST
- 536 (0x218)
Message identifier.
- wParam
-
Value Meaning - PBT_APMSUSPEND
- 4 (0x4)
Event identifier.
- lParam
-
Reserved; must be zero.
Return value
No return value.
Remarks
An application should process this event by completing all tasks necessary to save data. This event may also be broadcast, without a prior PBT_APMQUERYSUSPEND event, if an application or device driver uses the SetSystemPowerState function to force suspension.
The system allows approximately two seconds for an application to handle this notification. If an application is still performing operations after its time allotment has expired, the system may interrupt the application.
Windows Server 2003 and Windows XP: Applications are allowed up to 20 seconds to respond to the PBT_APMSUSPEND event.
Requirements
|
Minimum supported client | Windows XP [desktop apps only] |
|---|---|
|
Minimum supported server | Windows Server 2003 [desktop apps only] |
|
Header |
|
See also
- System Sleep Criteria
- System Wake-up Events
- Power Management Events
- PBT_APMQUERYSUSPEND
- SetSystemPowerState
- WM_POWERBROADCAST
Send comments about this topic to Microsoft
Build date: 10/26/2012