Click to See Complete Forum and Search --> : How to place MessageBox *always* in center of screen?


Volkan
February 23rd, 2000, 11:56 AM
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.

Tomcat
February 23rd, 2000, 01:19 PM
::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).

Saeed
February 23rd, 2000, 07:22 PM
Try AfxMessageBox()
I believe it displays in the mid of the screen