RegisterSuspendResumeNotification function
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 WINAPI RegisterSuspendResumeNotification( _In_ HANDLE hRecipient, _In_ DWORD Flags );
Parameters
- hRecipient [in]
-
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.
- Flags [in]
-
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
|
Minimum supported client |
Windows 8 [desktop apps only] |
|---|---|
|
Minimum supported server |
Windows Server 2012 [desktop apps only] |
|
Header |
|
|
Library |
|
|
DLL |
|
See also
- UnregisterSuspendResumeNotification
- DEVICE_NOTIFY_SUBSCRIBE_PARAMETERS
- DEVICE_NOTIFY_CALLBACK_ROUTINE