From 758095adb38179d0cc9415763df7ef774d81db60 Mon Sep 17 00:00:00 2001 From: ruevs Date: Sun, 10 Jan 2021 00:31:25 +0200 Subject: [PATCH] =?UTF-8?q?Win32:=20Avoid=20the=20"Default=20Beep"=20sound?= =?UTF-8?q?=20in=20"=D0=95rror"=20and=20"Message"=20dialogs=20(#881)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On Windows SolveSpace 2.3 uses a plain dialog for `SolveSpace::Error` and `SolveSpace::Message` with no icon and no system beep. After the GUI abstraction was reworked this changed to the default system message boxes (using MessageBoxIndirectW) that play the "Default Beep" sound and show red "X" and blue "i" icons respectively. The beep is annoying since the error and message dialogs are used often to show required conditions for constraints, new groups and other behaviors. This disables the beep and uses the SolveSpace icon. Fixes: 719 --- src/platform/guiwin.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/platform/guiwin.cpp b/src/platform/guiwin.cpp index ebd2667b..745720a4 100644 --- a/src/platform/guiwin.cpp +++ b/src/platform/guiwin.cpp @@ -1450,7 +1450,10 @@ public: void SetType(Type type) override { switch(type) { case Type::INFORMATION: - style = MB_ICONINFORMATION; + style = MB_USERICON; // Avoid beep + mbp.hInstance = GetModuleHandle(NULL); + mbp.lpszIcon = MAKEINTRESOURCE(4000); // Use SolveSpace icon + // mbp.lpszIcon = IDI_INFORMATION; break; case Type::QUESTION: @@ -1462,7 +1465,10 @@ public: break; case Type::ERROR: - style = MB_ICONERROR; + style = MB_USERICON; // Avoid beep + mbp.hInstance = GetModuleHandle(NULL); + mbp.lpszIcon = MAKEINTRESOURCE(4000); // Use SolveSpace icon + // mbp.lpszIcon = IDI_ERROR; break; } }