From: LoRd_MuldeR Date: Sat, 29 May 2021 02:04:56 +0000 (+0200) Subject: In fatal_exit() function: Clear the TOPMOST attribute of all windows, before showing... X-Git-Tag: v1.15~7 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=b6091380a65b0d3b26e40be98f0c34c94a28e048;p=mutilities%2FMUtilities.git In fatal_exit() function: Clear the TOPMOST attribute of all windows, before showing the message box. --- diff --git a/src/OSSupport_Win32.cpp b/src/OSSupport_Win32.cpp index 2db908f..df60224 100644 --- a/src/OSSupport_Win32.cpp +++ b/src/OSSupport_Win32.cpp @@ -2012,10 +2012,10 @@ static volatile bool g_debug_check = check_debugger_helper(); static MUtils::Internal::CriticalSection g_fatal_exit_lock; static QAtomicInt g_fatal_exit_flag; -static DWORD WINAPI fatal_exit_helper(LPVOID lpParameter) +static BOOL CALLBACK fatal_exit_enum_helper(const HWND hwnd, const LPARAM lParam) { - MUtils::OS::system_message_err(L"GURU MEDITATION", (LPWSTR) lpParameter); - return 0; + SetWindowPos(hwnd, HWND_NOTOPMOST, NULL, NULL, NULL, NULL, SWP_ASYNCWINDOWPOS | SWP_NOMOVE | SWP_NOSIZE); + return TRUE; } void MUtils::OS::fatal_exit(const wchar_t* const errorMessage) @@ -2027,6 +2027,8 @@ void MUtils::OS::fatal_exit(const wchar_t* const errorMessage) return; /*prevent recursive invocation*/ } + EnumThreadWindows(g_main_thread_id, fatal_exit_enum_helper, 0L); + if(g_main_thread_id != GetCurrentThreadId()) { if(HANDLE hThreadMain = OpenThread(THREAD_SUSPEND_RESUME, FALSE, g_main_thread_id)) @@ -2035,14 +2037,7 @@ void MUtils::OS::fatal_exit(const wchar_t* const errorMessage) } } - if(HANDLE hThread = CreateThread(NULL, 0, fatal_exit_helper, (LPVOID)errorMessage, 0, NULL)) - { - WaitForSingleObject(hThread, INFINITE); - } - else - { - fatal_exit_helper((LPVOID)errorMessage); - } + MUtils::OS::system_message_err(L"GURU MEDITATION", errorMessage); for(;;) {