Is there any ~simple way to force a fixed width font to MessageBoxA ?
Posted on 2002-07-26 11:40:28 by Maverick
Umm... no? :D
Posted on 2002-07-26 11:47:29 by iblis
Certainly not simple. I guess you'll have to launch another thread, then FindWindow the message box dialog, and go from there.
Posted on 2002-07-26 12:18:00 by comrade
Well actually I know a little trick concerning message boxes.
Let me see, how does that go again... :rolleyes: Oh yeah...

WH_CBT equ 5

invoke SetWindowsHookEx, WH_CBT, ADDR CBTProc, hInstance, hThreadID
mov hHook, eax
invoke MessageBox, blah blah blah

proc CBTProc nCode:dword, wParam:dword, lParam:dword
; only react to activations
.if nCode == HCBT_ACTIVATE
; Place code here, Handle of MessageBox is in wParam

; Unhook the MessageBox
invoke UnhookWindowsHookEx, hHook

Basically, you place in a CBT hook and check for the message HCBT_ACTIVATE
which is sent to the proc just before it is actually shown on screen. In the
middle of the proc, you should be able to use the handle to reposition the
box where you like, or I believe change the font its using.

Posted on 2002-07-26 14:50:32 by Graebel
Maverick, you will find an useful tutorial on the website of this excellent Windows coder : http://freespace.virgin.net/james.brown7/tuts/msgbox.htm
It is quite the same method of the one Graebel posted, but it has more explainations ;)
I hope this will be useful to you. ;)
Posted on 2002-07-26 15:58:22 by JCP
I don't think installing a system hook just to change the font of a message box is what he meant by "simple", especially since he italicized it.

I could be wrong.

What I would probably do is just create my own message box. Pretty simple: a window, a few buttons, and an icon.
Posted on 2002-07-26 18:13:43 by iblis
Isn't that what Delphi/VCL does?
Posted on 2002-07-26 21:57:39 by comrade
iblis, the problem with that method is most of the time the message box needs to appear like part of the system - except for the element you change. Delphi interfaces are very distinct and don't blend well with other appilcations, imho. If you don't care about appearance, or are going to read all the system metrics to create your own then this doesn't matter.
Posted on 2002-07-26 22:31:33 by bitRAKE
A big thank you to all those that replied. :)
Posted on 2002-07-27 08:52:33 by Maverick
A bit improved version (in comparison with James Brown's) of custom MessageBox.
There is no fixed-width font in it, but it's no problem for you to implement any font you like.
Have fun! ;)

PS: haven't tried to change caption font yet.
Posted on 2002-07-28 18:38:06 by Four-F
Thank you :)
Posted on 2002-07-29 08:19:42 by Maverick