Changeset View
Changeset View
Standalone View
Standalone View
src/qt/winshutdownmonitor.cpp
Show First 20 Lines • Show All 50 Lines • ▼ Show 20 Lines | bool WinShutdownMonitor::nativeEventFilter(const QByteArray &eventType, | ||||
} | } | ||||
return false; | return false; | ||||
} | } | ||||
void WinShutdownMonitor::registerShutdownBlockReason(const QString &strReason, | void WinShutdownMonitor::registerShutdownBlockReason(const QString &strReason, | ||||
const HWND &mainWinId) { | const HWND &mainWinId) { | ||||
typedef BOOL(WINAPI * PSHUTDOWNBRCREATE)(HWND, LPCWSTR); | typedef BOOL(WINAPI * PSHUTDOWNBRCREATE)(HWND, LPCWSTR); | ||||
PSHUTDOWNBRCREATE shutdownBRCreate = (PSHUTDOWNBRCREATE)GetProcAddress( | PSHUTDOWNBRCREATE shutdownBRCreate = | ||||
GetModuleHandleA("User32.dll"), "ShutdownBlockReasonCreate"); | static_cast<PSHUTDOWNBRCREATE>(GetProcAddress( | ||||
GetModuleHandleA("User32.dll"), "ShutdownBlockReasonCreate")); | |||||
if (shutdownBRCreate == nullptr) { | if (shutdownBRCreate == nullptr) { | ||||
qWarning() << "registerShutdownBlockReason: GetProcAddress for " | qWarning() << "registerShutdownBlockReason: GetProcAddress for " | ||||
"ShutdownBlockReasonCreate failed"; | "ShutdownBlockReasonCreate failed"; | ||||
return; | return; | ||||
} | } | ||||
if (shutdownBRCreate(mainWinId, strReason.toStdWString().c_str())) | if (shutdownBRCreate(mainWinId, strReason.toStdWString().c_str())) | ||||
qWarning() << "registerShutdownBlockReason: Successfully registered: " + | qWarning() << "registerShutdownBlockReason: Successfully registered: " + | ||||
strReason; | strReason; | ||||
else | else | ||||
qWarning() << "registerShutdownBlockReason: Failed to register: " + | qWarning() << "registerShutdownBlockReason: Failed to register: " + | ||||
strReason; | strReason; | ||||
} | } | ||||
#endif | #endif |