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

    How to place MessageBox *always* in center of screen?

    It's obvious that calls to AfxMessageBox() always center themselves in the window object from where they are called, but can I change this behavior so that my calls to AfxMessageBox() are always in the center of the screen?

    I guess I could create my own modal dialog class with a new constructor that takes a string argument (the error message). Is this the only way?

    Thanks.




  2. #2
    Join Date
    Jan 2000
    Location
    Sweden
    Posts
    197

    Re: How to place MessageBox *always* in center of screen?

    ::MessageBox(NULL, "Error text", "Title", MB_ICONSTOP|MB_OK|MB_TASKMODAL );

    The TASK_MODAL flag will disable all top-level windows, and hWnd=NULL will center the messgae box on the screeen (since it has no window).


  3. #3
    Join Date
    May 1999
    Location
    G day Mayt Land
    Posts
    971

    Re: How to place MessageBox *always* in center of screen?

    Try AfxMessageBox()
    I believe it displays in the mid of the screen

    Using Java version on windows 1.8_51

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