PowerSettingRegisterNotification function

Registers to receive notification when a power setting changes.

Syntax

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

Parameters

SettingGuid

A GUID that represents the power setting.

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

A handle to the recipient of the notifications.

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

   
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