PBT_APMSUSPEND event
Applies to: desktop apps only
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 |
|---|---|
|
Minimum supported server | Windows Server 2003 |
|
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: 2/7/2012
PBT_APMSUSPEND is fired for both standby and hibernate events. I could not find any way to determine which sleep state the system will enter. Any idea?
(Note that PBT_APMSTANDBY is not being fired as of Win 2000 and later.)
dero
- 2/25/2008
- dero79
- 4/28/2008
- CarolBuchmiller - MSFT