Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

MessageBox centered on Window after resize

Posted on 2007-11-26
3
Medium Priority
?
483 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 1000 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

Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

Question has a verified solution.

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

Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

886 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