Solved

MessageBox centered on Window after resize

Posted on 2007-11-26
3
466 Views
Last Modified: 2013-12-03
hi,

i have a dialogbased software. The dialog will be resied from time to time. But if I throw a messagebox the messagebox is not centered to the resized window rect, it is centered to the original (dialog init) rect. How I can change this that the messagebox comes centered of my resized dialog. Actual it looks like that the messagebox do not come from my software. :(

Ingo
0
Comment
Question by:Ocrana
3 Comments
 
LVL 8

Expert Comment

by:Thejaka
ID: 20355373
If the MessageBox looks like it's not from your app, try passing the owner (HWND) to the message box function.

I can't see how the MessageBox could come to be centered to the original rect, unless purely by chance... You show the message box after resizing is complete, right?
0
 
LVL 55

Accepted Solution

by:
Jaime Olivares earned 250 total points
ID: 20355410
If you want full control of your MessageBox, you can use your own:
http://www.codeproject.com/dialog/CPPMessageBox.asp
http://www.codeproject.com/dialog/xmessagebox.asp
0
 

Author Comment

by:Ocrana
ID: 20358715
Finaly my question seems to be wrong. The problem do not occour on the resized dialog, it was only a "look & feel) thing. THe problem itself is, that the messagebox is thrown while a thread is running. In the thread I throw the messagebox with the HWND of the dialog that starts the thread.
But it use allways the HWND of the desktop and not of my software. Outside the thread it use the HWND of my dialog but only from the thread it seems it overwrite allways the HWND of the dialog with the one of the Desktop.
0

Featured Post

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Best book to learn C++ 4 84
What .NET website keeps me current? 9 77
C++ mouse_event mouse look 7 98
draw a Christmas tree by using a nested loop? 26 77
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question