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

    Centering MessageBox to the owner window

    I need to display a MessageBox (MFC version) which would centered the application window instead of the desktop. A SDK version of MessageBox take the handle of the owner window as its first parameter but MFC version does not have this options. Thanks.


  2. #2
    Join Date
    May 1999
    Location
    WA
    Posts
    65

    Re: Centering MessageBox to the owner window

    Is there a specific reason that you must use the CWnd::MessageBox instead of ::MessageBox?? I believe that the only way that you're going to accomplish what you want is to use the ::MessageBox function, and give it the handle to the parent window that you want the messageBox to be centered on.

    Example:
    ::MessageBox(this->GetSafeHwnd(), _T("MessageBody"), _T("Title"), MB_OK|MB_ICONEXCLAMATION);

    That should solve that problem for you.. Good luck.


    - Troy

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