From 8bbab637b5e0a94f0ccb209a8b50f0b7e032391f Mon Sep 17 00:00:00 2001 From: Paravis Date: Sun, 8 Nov 2026 23:37:34 +0300 Subject: [PATCH] Make dialogs modal and topmost --- README.md | 2 ++ src/install.cpp | 8 +++++++- src/main.cpp | 3 ++- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index ebdab15..20bb0ec 100644 --- a/README.md +++ b/README.md @@ -56,6 +56,8 @@ build\Release\ParavisInstaller.exe ## Примечания +- Все предупреждения и подтверждения — модальные: блокируют главное окно и + показываются поверх него. - `Data.pf` ищется рядом с exe, как и в AutoIt-версии. `/wim=` остаётся служебным/тестовым переопределением. - Командные строки DISM собираются без внешней пары кавычек `cmd /c "..."`, diff --git a/src/install.cpp b/src/install.cpp index 65ef105..83f4e7e 100644 --- a/src/install.cpp +++ b/src/install.cpp @@ -721,10 +721,16 @@ int App::ShowMessage(UINT flags, const wchar_t* title, const std::wstring& text) modal = true; GoState(false); DimControls(true); + EnableWindow(hwnd, FALSE); + UpdateWindow(hwnd); + SetForegroundWindow(hwnd); - int result = MessageBoxW(hwnd, text.c_str(), title, flags); + int result = MessageBoxW(hwnd, text.c_str(), title, + flags | MB_SETFOREGROUND | MB_TOPMOST); DebugLog(L"MsgBox exit title=%s result=%d", title, result); + EnableWindow(hwnd, TRUE); + SetForegroundWindow(hwnd); modal = previous; clickGuard = GetTickCount64(); if (!busy) { diff --git a/src/main.cpp b/src/main.cpp index 7e8aa5f..37f0bb9 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -986,7 +986,8 @@ int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE, LPWSTR, int) SetForegroundWindow(existing); } else { MessageBoxW(nullptr, L"Paravis installer уже запущен.", - L"Paravis installer", MB_ICONINFORMATION | MB_OK); + L"Paravis installer", + MB_ICONINFORMATION | MB_OK | MB_SETFOREGROUND | MB_TOPMOST); } CloseHandle(instanceMutex); return 0;