PowerRegisterSuspendResumeNotification function (powerbase.h)

Registers to receive notification when the system is suspended or resumed.

Syntax

DWORD PowerRegisterSuspendResumeNotification(
  [in]  DWORD         Flags,
  [in]  HANDLE        Recipient,
  [out] PHPOWERNOTIFY RegistrationHandle
);

Parameters

[in] Flags

This parameter must be DEVICE_NOTIFY_CALLBACK.

[in] Recipient

This parameter is a pointer to a DEVICE_NOTIFY_SUBSCRIBE_PARAMETERS structure. In this case, the callback function is DeviceNotifyCallbackRoutine. When the Callback function executes, the Type parameter is set indicating the type of event that occurred. Possible values include PBT_APMSUSPEND, PBT_APMRESUMESUSPEND, and PBT_APMRESUMEAUTOMATIC - see Power Management Events for more info. The Setting parameter is not used with suspend/resume 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.

Requirements

Requirement Value
Minimum supported client Windows 8 [desktop apps only]
Minimum supported server Windows Server 2012 [desktop apps only]
Target Platform Windows
Header powerbase.h
Library Powrprof.lib
DLL Powrprof.dll

See also

DEVICE_NOTIFY_CALLBACK_ROUTINE

DEVICE_NOTIFY_SUBSCRIBE_PARAMETERS

PowerUnregisterSuspendResumeNotification