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