Control size of Message Box

Jul 24, 2013 at 2:50am
closed account (jwkNwA7f)
I have been reading Charles Petzoid's Programming Windows 5th Edition.

I have learned how to make a dialog box like this:

1
2
3
4
5
6
7
#include "windows.h"

int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLind, int iComdShow)
{
	MessageBox (NULL, TEXT ("Hello World!"), TEXT ("HelloMsg"), 0);
	return 0;
}


But, I would like to control the size of the dialog box.

Thank you!
Jul 24, 2013 at 3:57am
I don't think that you can resize the MessageBox. It resizes automatically to the text/buttons. You might want to create your own DialogBox instead.
Jul 24, 2013 at 10:50am
Unfortunately, MessageBox has it's own ideas.

Why doesn't my MessageBox wrap at the right location?
http://blogs.msdn.com/b/oldnewthing/archive/2011/06/24/10178386.aspx

If you want to control the size, you'll need to code your own dialog (or ever custom messagebox), as ats15 has already said.

Andy
Last edited on Jul 24, 2013 at 10:51am
Jul 24, 2013 at 6:14pm
closed account (jwkNwA7f)
I will try making a DialogBox instead.
Jul 24, 2013 at 7:43pm
In case you're interested:

Another Raymond Chen article:

Building a dialog template at run-time
http://blogs.msdn.com/b/oldnewthing/archive/2005/04/29/412577.aspx

And...

XMessageBox - A reverse-engineered MessageBox()
http://www.codeproject.com/Articles/1239/XMessageBox-A-reverse-engineered-MessageBox

Andy
Last edited on Jul 24, 2013 at 7:44pm
Jul 24, 2013 at 7:56pm
closed account (jwkNwA7f)
I haven't looked at the second one yet, but the first one looks interesting.

Thank you!
Topic archived. No new replies allowed.