Platform SDK: Hardware

WM_POWER

The WM_POWER message is broadcast when the system, typically a battery-powered personal computer, is about to enter suspended mode.

Note  The WM_POWER message is obsolete. It is provided only for compatibility with 16-bit Windows-based applications. Win32-based applications should use the WM_POWERBROADCAST message.

A window receives this message through its WindowProc function.

LRESULT CALLBACK WindowProc(
  HWND hwnd,       // handle to window
  UINT uMsg,       // WM_POWER
  WPARAM wParam,   // power-event notification
  LPARAM lParam    // not used
);

Parameters

wParam
Specifies a power-event notification. This parameter can be one of the following values.
Value Meaning
PWR_CRITICALRESUME Indicates that the system is resuming operation after entering suspended mode without first broadcasting a PWR_SUSPENDREQUEST notification message to the application. An application should perform any necessary recovery actions.
PWR_SUSPENDREQUEST Indicates that the system is about to enter suspended mode.
PWR_SUSPENDRESUME Indicates that the system is resuming operation after having entered suspended mode normally — that is, the system broadcast a PWR_SUSPENDREQUEST notification message to the application before the system was suspended. An application should perform any necessary recovery actions.

lParam
This parameter is not used.

Return Values

The value an application returns depends on the value of the wParam parameter. If wParam is PWR_SUSPENDREQUEST, the return value is PWR_FAIL to prevent the system from entering the suspended state; otherwise, it is PWR_OK. If wParam is PWR_SUSPENDRESUME or PWR_CRITICALRESUME, the return value is zero.

Remarks

This message is broadcast only to an application that is running on a system that conforms to the Advanced Power Management (APM) basic input/output system (BIOS) specification. The message is broadcast by the power-management driver to each window returned by the EnumWindows function.

The suspended mode is the state in which the greatest amount of power savings occurs, but all operational data and parameters are preserved. Random-access memory (RAM) contents are preserved, but many devices are likely to be turned off.

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winuser.h; include Windows.h.

See Also

Power Management Overview, Power Management Messages, EnumWindows, WM_POWERBROADCAST