Page 1 of 1

Msgbox font size

Posted: 16 Mar 2017, 04:40
by toolman59
Is it possible to change the font size in Msgbox?

Re: Msgbox font size

Posted: 16 Mar 2017, 07:34
by thenasos
No.
Try using Progress / SplashImage
https://autohotkey.com/docs/commands/Progress.htm

Re: Msgbox font size

Posted: 16 Mar 2017, 07:41
by MilesAhead
Nope. To customize a MessageBox the thing to do is create a Gui that looks like the dialog produced by MsgBox. Back in the day I wrote a Delphi Control that customized the Delphi MessageBox by overriding the OnPaint event. Even then the best I could do with the text is set the Font size to 10(the default is 9) and Bold. It was easier to read. If you try to jury rig a font larger than 10 all the other metrics of the MessageBox are thrown off. It will look obviously skewed when displayed. But in my case the main reason for overriding OnPaint was so that I could draw non standard backgrounds with either striping colored zones or gradients

Rolling your own is the way to go.

Re: Msgbox font size

Posted: 16 Mar 2017, 08:38
by jmeneses
Maybe it will help you TaskDialog or Custom message Box(CMsgox)

Re: Msgbox font size

Posted: 16 Mar 2017, 13:07
by toolman59
Thank you all, I will follow up on the leads in your posts, this will give me plenty to work on.

Re: Msgbox font size

Posted: 16 Mar 2017, 14:11
by jeeswg
Although ultimately I would recommend using custom MsgBox functions. It should be stated that this *is* possible.

from:
best utilities + best AutoHotkey scripts (+ useful tips) - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?t=28149

[get/set MsgBox font system-wide]
[function: JEE_SystemGetFont][function: JEE_SystemSetFont]
GUI COMMANDS: COMPLETE RETHINK - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=5&t=25893
[Function] MsgBox Font Information - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=6&t=9122

==================================================

The MsgBox command uses the MessageBox dll function:
MessageBox function (Windows)
https://msdn.microsoft.com/en-us/librar ... s.85).aspx

The MessageBox dll function uses the system-wide 'Message' font, which other programs use for different purposes e.g. Mozilla Firefox.
NONCLIENTMETRICS structure (Windows)
https://msdn.microsoft.com/en-us/librar ... s.85).aspx

The 'Message Box' font can be changed manually on Windows 7 here:
Control Panel\Appearance and Personalization\Personalization
Window Color
Item: Message Box

==================================================

Btw AutoHotkey's InputBox uses a custom GUI. One hack is to use SetTimer, and change the window/control sizes and font (using WM_SETFONT).

In order to change the MsgBox font without affecting other programs and for other reasons, I'm trying to create custom MsgBox/InputBox functions.

Re: Msgbox font size

Posted: 16 Mar 2017, 16:10
by MilesAhead
jeeswg wrote:Although ultimately I would recommend using custom MsgBox functions. It should be stated that this *is* possible.
From playing with the example program I see you are quite right. It has been quite a few years since I did the Delphi Window Controls that I used as the basis for ActiveX Controls. It turns out the dialogs I was modifying were not plain message boxes but Info, Confirm, Error and Warning dialogs with Icon etc.. They were much more sensitive to even a slight increase in font size than the plain message boxes shown in the code you linked. :thumbup:

Re: Msgbox font size

Posted: 16 Mar 2017, 18:54
by jeeswg
It was thanks to the post in the link above by iPhilip that I started to find out all of this, including how to programmatically change other fonts in the Control Panel dialog.
[Function] MsgBox Font Information - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=6&t=9122

This post also by iPhilip shows how to create what I call a new-style 'two-colour' MsgBox.
Gui that looks like a MsgBox - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?t=9043

There's also examples there of MsgBoxes with a countdown and with a hyperlink.

If you use Gui, Color, FF0000, it changes the bottom colour. But I don't know how to change the top colour, if anyone knows. You can change this colour in Control Panel, but it doesn't affect the Gui command. Workarounds are possible but I would like to know! Cheers.

Re: Msgbox font size

Posted: 20 Mar 2017, 02:46
by toolman59
I have followed the link https://autohotkey.com/boards/viewtopic.php?f=6&t=9043 in jeeswg's post and have used the script MsgBoxGui.ahk to produce a msgbox that does exactly what I wanted. I can change the font and font size to suit my requirements.

Thanks again for all your help

Re: Msgbox font size

Posted: 05 Feb 2022, 18:43
by LAPIII
Where can I get MsgBoxGui.ahk? I want to change the font in a message box.

Re: Msgbox font size

Posted: 05 Feb 2022, 18:50
by boiler
LAPIII wrote: Where can I get MsgBoxGui.ahk? I want to change the font in a message box.
It’s in this post. It’s not just changing the font of a MsgBox. It’s making a GUI that acts like a MsgBox, hence the name.