PowerSettingRegisterNotification function (powersetting.h)

Registers to receive notification when a power setting changes.

Syntax

DWORD PowerSettingRegisterNotification(
  [in]  LPCGUID       SettingGuid,
  [in]  DWORD         Flags,
  [in]  HANDLE        Recipient,
  [out] PHPOWERNOTIFY RegistrationHandle
);

Parameters

[in] SettingGuid

A GUID that represents the power setting.

[in] Flags

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

Value Meaning
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 this case is expected to be of type PDEVICE_NOTIFY_SUBSCRIBE_PARAMETERS.

[in] Recipient

A handle to the recipient of the notifications.

[out] RegistrationHandle

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

Requirement Value
Minimum supported client Windows 7 [desktop apps only]
Minimum supported server Windows Server 2008 R2 [desktop apps only]
Target Platform Windows
Header powersetting.h
Library Powrprof.lib
DLL Powrprof.dll

See also

Power Setting GUIDs

PowerSettingUnregisterNotification