Disable main window when showing msgbox in wxSafeShowMessage()

Pass correct parent HWND to ::MessageBox() in order to disable the
window while the message box is shown, as this function is supposed to
be similar to modal wxMessageBox() and it was unexpected that the
application could be reentered via the event handlers from inside it.

This required adding wxAppTraits::GetMainHWND() in order to only use the
HWND in GUI applications from the function defined in non-GUI code.
This commit is contained in:
Vadim Zeitlin
2021-03-07 15:37:35 +01:00
parent 9073221584
commit 39883a270a
4 changed files with 16 additions and 1 deletions

View File

@@ -58,6 +58,9 @@ public:
// write text to the console, return true if ok or false on error
virtual bool WriteToStderr(const wxString& text) = 0;
// return the main application window or 0 if none
virtual WXHWND GetMainHWND() const = 0;
protected:
#if wxUSE_THREADS
// implementation of WaitForThread() for the console applications which is