Export (0) Print
Expand All

WM_POWER message

Notifies applications that the system, typically a battery-powered personal computer, is about to enter a suspended mode.

Note  The WM_POWER message is obsolete. It is provided only for compatibility with 16-bit Windows-based applications. 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

hwnd

A handle to window.

uMsg

The WM_POWER message identifier.

wParam

The power-event notification. This parameter can be one of the following values.

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

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

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

WM_POWERBROADCAST

 

 

Community Additions

ADD
Show:
© 2014 Microsoft