8 #if defined(Q_OS_WIN) && QT_VERSION >= 0x050000
17 bool WinShutdownMonitor::nativeEventFilter(
const QByteArray &eventType,
void *pMessage,
long *pnResult)
21 MSG *pMsg =
static_cast<MSG *
>(pMessage);
25 case WM_QUERYENDSESSION:
44 void WinShutdownMonitor::registerShutdownBlockReason(
const QString& strReason,
const HWND& mainWinId)
46 typedef BOOL (WINAPI *PSHUTDOWNBRCREATE)(HWND, LPCWSTR);
47 PSHUTDOWNBRCREATE shutdownBRCreate = (PSHUTDOWNBRCREATE)GetProcAddress(GetModuleHandleA(
"User32.dll"),
"ShutdownBlockReasonCreate");
48 if (shutdownBRCreate == NULL) {
49 qDebug() <<
"registerShutdownBlockReason : GetProcAddress for ShutdownBlockReasonCreate failed";
53 if (shutdownBRCreate(mainWinId, strReason.toStdWString().c_str()))
54 qDebug() <<
"registerShutdownBlockReason : Successfully registered: " + strReason;
56 qDebug() <<
"registerShutdownBlockReason : Failed to register: " + strReason;