Export (0) Print
Expand All
Expand Minimize
7 out of 13 rated this helpful - Rate this topic

RegisterPowerSettingNotification function

Registers the application to receive power setting notifications for the specific power setting event.

Syntax


HPOWERNOTIFY WINAPI RegisterPowerSettingNotification(
  _In_  HANDLE hRecipient,
  _In_  LPCGUID PowerSettingGuid,
  _In_  DWORD Flags
);

Parameters

hRecipient [in]

Handle indicating where the power setting notifications are to be sent. For interactive applications, the Flags parameter should be zero, and the hRecipient parameter should be a window handle. For services, the Flags parameter should be one, and the hRecipient parameter should be a SERVICE_STATUS_HANDLE as returned from RegisterServiceCtrlHandlerEx.

PowerSettingGuid [in]

The GUID of the power setting for which notifications are to be sent. For more information see Registering for Power Events.

Flags [in]
ValueMeaning
DEVICE_NOTIFY_WINDOW_HANDLE
0

Notifications are sent using WM_POWERBROADCAST messages with a wParam parameter of PBT_POWERSETTINGCHANGE.

DEVICE_NOTIFY_SERVICE_HANDLE
1

Notifications are sent to the HandlerEx callback function with a dwControl parameter of SERVICE_CONTROL_POWEREVENT and a dwEventType of PBT_POWERSETTINGCHANGE.

 

Return value

Returns a notification handle for unregistering for power notifications. If the function fails, the return value is NULL. To get extended error information, call GetLastError.

Requirements

Minimum supported client

Windows Vista [desktop apps only]

Minimum supported server

Windows Server 2008 [desktop apps only]

Header

WinUser.h (include Windows.h)

Library

User32.lib

DLL

User32.dll

See also

Power Management Functions
Registering for Power Events
UnregisterPowerSettingNotification

 

 

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.