![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Newbie
Join Date: Jun 2005
Location: Portland, OR
Posts: 12
Rep Power: 0
![]() |
Center MessageBox() in Win32
Hi everyone:
I seem to be stumped by the simplest -- I have a Win32 program and I need to display a message box centered by the parent window. Here's the example: MessageBox(hParentWnd, "Message to display", "Program Name", MB_ICONERROR | MB_OK); Well, the problem is that it is centered in the middle of the screen and it's position has nothing to do with the parent window. I stepped through the entire AfxMessageBox() in MFC, which by the way places it's message box in the middle of a parent window, and found absolutely nothing. Can someone tell me what am I doing wrong? |
|
|
|
|
|
#2 |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
Are you passing a parent window handle, or NULL? If NULL, it has no parent window. At any rate, if you get the handle to it, you should be able to use MoveWindow. When you first display it, you should be able to get its handle by one of several mechanisms.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code. Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers |
|
|
|
|
|
#3 | ||
|
Newbie
Join Date: Jun 2005
Location: Portland, OR
Posts: 12
Rep Power: 0
![]() |
Quote:
Quote:
Please don't tell me that I'll have to subclass MessageBox? |
||
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|