Click to Rate and Give Feedback
MSDN
MSDN Library
System Services
Power Management
 RegisterPowerSettingNotification Fu...
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]
Value Meaning

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.

Requirements

ClientRequires Windows Vista.
ServerRequires Windows Server 2008.
Header Declared in WinUser.h; include Windows.h.
Library Use User32.lib.
DLL Requires User32.dll.

See Also

Power Management Functions
Registering for Power Events
UnregisterPowerSettingNotification


Send comments about this topic to Microsoft

Build date: 8/28/2008

Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2008 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker