2 out of 2 rated this helpful - Rate this topic

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
ValueMeaning
WM_POWERBROADCAST
536 (0x218)

Message identifier.

 

wParam
ValueMeaning
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

WinUser.h (include Windows.h)

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

Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ
Possible to get kind of sleep state?
[Carol Buchmiller - MSFT] Please post questions to the MSDN Forums at http://forums.microsoft.com/msdn. You will likely get a quicker response through the forum than through the Community Content. Thanks!


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