Make dialogs modal and topmost

This commit is contained in:
paravis committed 2026-11-08 23:37:35 +03:00
1 parent 9089fbf7de
commit 77d88235c5
3 files changed
+20 -4

No files matched your search

+2
View File
@@ -42,6 +42,8 @@ build\Release\Change_BootLoader.exe
устанавливаемого загрузчика остаётся чуть ярче.
- Повторный запуск запрещён: второй экземпляр активирует уже открытое окно
и сразу завершается.
- Все предупреждения — модальные: блокируют главное окно и показываются
поверх него.
- Отладочный лог по умолчанию выключен. `PARAVIS_DEBUG_LOG=1` включает
запись в `%TEMP%\cbl_cpp_debug.log`.
- Действие «GRUB2 Legacy» использует те же команды bootice `/sectors`, что и
+8 -1
View File
@@ -7,7 +7,14 @@ void App::ShowMessage(const std::wstring& text, UINT flags)
{
bool previous = modal;
modal = true;
MessageBoxW(hwnd, text.c_str(), L"Change BootLoader", flags);
EnableWindow(hwnd, FALSE);
InvalidateRect(hwnd, nullptr, FALSE);
UpdateWindow(hwnd);
SetForegroundWindow(hwnd);
MessageBoxW(hwnd, text.c_str(), L"Change BootLoader",
flags | MB_SETFOREGROUND | MB_TOPMOST);
EnableWindow(hwnd, TRUE);
SetForegroundWindow(hwnd);
modal = previous;
InvalidateRect(hwnd, nullptr, FALSE);
}
+10 -3
View File
@@ -258,6 +258,10 @@ void App::Paint(HDC dc)
border = ColorFromHex(CLR_BUSY_BORDER);
text = ColorFromHex(CLR_BUSY_TEXT);
}
} else if (modal) {
background = ColorFromHex(CLR_BUSY_BG);
border = ColorFromHex(CLR_BUSY_BORDER);
text = ColorFromHex(CLR_BUSY_TEXT);
}
FillRectColor(memory, x - 1, y - 1, bw + 2, bh + 2, border);
@@ -386,7 +390,8 @@ int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE, LPWSTR, int)
SetForegroundWindow(existing);
} else {
MessageBoxW(nullptr, L"Change BootLoader уже запущен.",
kWindowTitle, MB_ICONINFORMATION | MB_OK);
kWindowTitle,
MB_ICONINFORMATION | MB_OK | MB_SETFOREGROUND | MB_TOPMOST);
}
CloseHandle(instanceMutex);
return 0;
@@ -398,7 +403,8 @@ int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE, LPWSTR, int)
std::wstring exeDir = GetExeDir();
if (exeDir.size() < 2 || exeDir[1] != L':') {
MessageBoxW(nullptr, L"Не удалось определить диск установщика.",
kWindowTitle, MB_ICONERROR | MB_OK);
kWindowTitle,
MB_ICONERROR | MB_OK | MB_SETFOREGROUND | MB_TOPMOST);
return 1;
}
@@ -413,7 +419,8 @@ int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE, LPWSTR, int)
if (!FileExists(app.bootice) || !FileExists(app.boot + L"\\NOT.DEL")) {
std::wstring text = L"Этот диск не является сборкой Paravis "
L"(нет bootice.exe или NOT.DEL):\r\n" + app.disk;
MessageBoxW(nullptr, text.c_str(), kWindowTitle, MB_ICONERROR | MB_OK);
MessageBoxW(nullptr, text.c_str(), kWindowTitle,
MB_ICONERROR | MB_OK | MB_SETFOREGROUND | MB_TOPMOST);
return 0;
}