X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/a7fd7c7851405371db0171181f240591cca38158..d8c65cf48881468f97798ac521fb93f9b8b5a293:/src/msw/msgdlg.cpp diff --git a/src/msw/msgdlg.cpp b/src/msw/msgdlg.cpp index 834fbdb022..af52a3d595 100644 --- a/src/msw/msgdlg.cpp +++ b/src/msw/msgdlg.cpp @@ -46,8 +46,7 @@ wxMessageDialog::wxMessageDialog(wxWindow *parent, int wxMessageDialog::ShowModal() { - wxWindow *winTop = wxTheApp->GetTopWindow(); - if ( !winTop ) + if ( !wxTheApp->GetTopWindow() ) { // when the message box is shown from wxApp::OnInit() (i.e. before the // message loop is entered), this must be done or the next message box @@ -58,11 +57,9 @@ int wxMessageDialog::ShowModal() } // use the top level window as parent if none specified - HWND hWnd = 0; - if ( m_parent ) - hWnd = GetHwndOf(m_parent); - else if ( winTop ) - hWnd = GetHwndOf(winTop); + if ( !m_parent ) + m_parent = FindSuitableParent(); + HWND hWnd = m_parent ? GetHwndOf(m_parent) : NULL; // translate wx style in MSW unsigned int msStyle = MB_OK;