Platform SDK: Hardware

PBT_APMQUERYSUSPEND

The PBT_APMQUERYSUSPEND event is broadcast to request permission to suspend the computer. An application that grants permission should carry out preparations for the suspension before returning.

A window receives this event through the WM_POWERBROADCAST message. The wParam and lParam parameters are set as described following.

Parameters

wParam
Set to PBT_APMQUERYSUSPEND.
lParam
A DWORD value that specifies action flags. If bit 0 is 1, the application can prompt the user for directions on how to prepare for the suspension; otherwise, the application must prepare without user interaction. All other bit values are reserved.

Return Values

Return TRUE to grant the request to suspend. To deny the request, return BROADCAST_QUERY_DENY.

Remarks

An application should process this event by first determining whether permission to suspend can be granted. It must not grant permission if doing so would cause a loss of data. The application can prompt the user for directions on how to prepare for suspension only if bit 0 in the Flags parameter is set.

The system allows approximately 20 seconds for an application to remove the WM_POWERBROADCAST message that is sending the PBT_APMQUERYSUSPEND event from the application's message queue. If an application does not remove the message from its queue in less then 20 seconds, the system will assume that the application is in a non-responsive state, and that the application agrees to the sleep request. Applications that do not process their message queues may have their operations interrupted. After it removes the message from the message queue, an application can take as much time as needed to perform any required operations before entering the sleep state. Any operations that could take longer then 20 seconds should be performed at this time, since the system allows only 20 seconds for operations to complete during PBT_APMSUSPEND processing.

Requirements

  Windows NT/2000: Requires Windows 2000.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Pbt.h.

See Also

Power Management Overview, Power Management Events, WM_POWERBROADCAST