Skip to content

Commit

Permalink
fix: register for connected standby changes (#25076) (#25163)
Browse files Browse the repository at this point in the history
Co-authored-by: Cheng Zhao <zcbenz@gmail.com>
  • Loading branch information
miniak and zcbenz committed Aug 28, 2020
1 parent 9f1b24d commit 7dafaf1
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions shell/browser/api/electron_api_power_monitor_win.cc
Expand Up @@ -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,
Expand Down

0 comments on commit 7dafaf1

Please sign in to comment.