RegisterSuspendResumeNotification function (winuser.h)
Registers to receive notification when the system is suspended or resumed. Similar to PowerRegisterSuspendResumeNotification, but operates in user mode and can take a window handle.
Syntax
HPOWERNOTIFY RegisterSuspendResumeNotification(
[in] HANDLE hRecipient,
[in] DWORD Flags
);
Parameters
[in] hRecipient
This parameter contains parameters for subscribing to a power notification or a window handle representing the subscribing process.
If Flags is DEVICE_NOTIFY_CALLBACK, hRecipient is interpreted as 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.
If Flags is DEVICE_NOTIFY_WINDOW_HANDLE, hRecipient is a handle to the window to deliver events to.
[in] Flags
This parameter can be DEVICE_NOTIFY_WINDOW_HANDLE or DEVICE_NOTIFY_CALLBACK.
Return value
A handle to the registration. Use this handle to unregister for notifications.
If the function fails, the return value is NULL. To get extended error information call GetLastError.
Requirements
Requirement | Value |
---|---|
Minimum supported client | Windows 8 [desktop apps only] |
Minimum supported server | Windows Server 2012 [desktop apps only] |
Target Platform | Windows |
Header | winuser.h |
Library | User32.lib |
DLL | User32.dll |
API set | ext-ms-win-ntuser-powermanagement-l1-1-0 (introduced in Windows 8) |
See also
DEVICE_NOTIFY_CALLBACK_ROUTINE