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.

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.

Requirements

Minimum supported client
Windows XP [desktop apps only]
Minimum supported server
Windows Server 2003 [desktop apps only]
Header
WinUser.h (include Windows.h)

See also

System Sleep Criteria

System Wake-up Events

Power Management Events

PBT_APMQUERYSUSPEND

SetSystemPowerState

WM_POWERBROADCAST