PowerSettingRegisterNotification function

Registers to receive notification when a power setting changes.

Syntax


DWORD WINAPI PowerSettingRegisterNotification(
  _In_  LPCGUID       SettingGuid,
  _In_  DWORD         Flags,
  _In_  HANDLE        Recipient,
  _Out_ PHPOWERNOTIFY RegistrationHandle
);

Parameters

SettingGuid [in]

A GUID that represents the power setting.

Flags [in]

Information about the recipient of the notification. This parameter can be one of the following values:

ValueMeaning
DEVICE_NOTIFY_SERVICE_HANDLE

The Recipient parameter is a handle to a service.Use the CreateService or OpenService function to obtain this handle.

DEVICE_NOTIFY_CALLBACK

The Recipient parameter is a pointer to a callback function to call when the power setting changes.

 

Recipient [in]

A handle to the recipient of the notifications.

RegistrationHandle [out]

A handle to the registration. Use this handle to unregister for notifications.

Return value

Returns ERROR_SUCCESS (zero) if the call was successful, and a nonzero value if the call failed.

Remarks

Immediately after registration, the callback will be invoked with the current value of the power setting. If the registration occurs while the power setting is changing, you may receive multiple callbacks; the last callback is the most recent update.

Requirements

Minimum supported client

Windows 7 [desktop apps only]

Minimum supported server

Windows Server 2008 R2 [desktop apps only]

Header

Powersetting.h;
Powrprof.h on Windows Server 2008 R2 and Windows 7

Library

Powrprof.lib

DLL

Powrprof.dll

See also

Power Setting GUIDs
PowerSettingUnregisterNotification

 

 

Show: