mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
Co-authored-by: Cheng Zhao <zcbenz@gmail.com>
This commit is contained in:
@@ -39,6 +39,18 @@ void PowerMonitor::InitPlatformSpecificMonitors() {
|
||||
|
||||
// Tel windows we want to be notified with session events
|
||||
WTSRegisterSessionNotification(window_, NOTIFY_FOR_THIS_SESSION);
|
||||
|
||||
// For Windows 8 and later, a new "connected standy" mode has been added and
|
||||
// we must explicitly register for its notifications.
|
||||
auto RegisterSuspendResumeNotification =
|
||||
reinterpret_cast<decltype(&::RegisterSuspendResumeNotification)>(
|
||||
GetProcAddress(GetModuleHandle(L"user32.dll"),
|
||||
"RegisterSuspendResumeNotification"));
|
||||
|
||||
if (RegisterSuspendResumeNotification) {
|
||||
RegisterSuspendResumeNotification(static_cast<HANDLE>(window_),
|
||||
DEVICE_NOTIFY_WINDOW_HANDLE);
|
||||
}
|
||||
}
|
||||
|
||||
LRESULT CALLBACK PowerMonitor::WndProcStatic(HWND hwnd,
|
||||
|
||||
Reference in New Issue
Block a user