CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Dec 2005
    Posts
    445

    AfxMessageBox position

    Hi all,

    My main dialog create and display a second dialog.
    The second dialog can create another dialog when a user click on a button:

    --------------- ------------ ------------
    | main dlg | -> | 2nd dlg | -> | 3rd dlg |
    --------------- ------------- ------------

    Code:
    void OnClick()
    {
        // Create the 3rd dialog
       m_pMy3rdDlg->Create(CMy3rdDlg::IDD, GetDesktopWindow());
       
       if ( !pMy3rdDlg->InitializationSucceeded() )
           AfxMessageBox( _T("Failed") ); 
    }
    My problem is that if my second dialog needs to display a message box,
    It is shown on the main dialog instead of the 2nd dialog.

    How can I sort it out?

    Many thanks!

  2. #2
    Join Date
    Sep 2004
    Location
    Holland (land of the dope)
    Posts
    4,123

    Re: AfxMessageBox position

    Use ::MessageBox() instead. You can pass a HWND to set the owner of the messagebox.

  3. #3
    Join Date
    Dec 2005
    Posts
    445

    Re: AfxMessageBox position

    Made my day, thank you!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured