Msgbox font size

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
toolman59
Posts: 3
Joined: 06 Mar 2017, 01:25
Location: United Kingdom

Msgbox font size

16 Mar 2017, 04:40

Is it possible to change the font size in Msgbox?
User avatar
thenasos
Posts: 79
Joined: 10 Nov 2015, 10:00

Re: Msgbox font size

16 Mar 2017, 07:34

No.
Try using Progress / SplashImage
https://autohotkey.com/docs/commands/Progress.htm
Shrek is love...
User avatar
MilesAhead
Posts: 232
Joined: 03 Oct 2013, 09:44

Re: Msgbox font size

16 Mar 2017, 07:41

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.
"My plan is to ghostwrite my biography. Then hire another writer to put his
name on it and take the blame."

- MilesAhead
User avatar
jmeneses
Posts: 524
Joined: 28 Oct 2014, 11:09
Location: Catalan Republic

Re: Msgbox font size

16 Mar 2017, 08:38

Maybe it will help you TaskDialog or Custom message Box(CMsgox)
Donec Perficiam
toolman59
Posts: 3
Joined: 06 Mar 2017, 01:25
Location: United Kingdom

Re: Msgbox font size

16 Mar 2017, 13:07

Thank you all, I will follow up on the leads in your posts, this will give me plenty to work on.
User avatar
jeeswg
Posts: 6902
Joined: 19 Dec 2016, 01:58
Location: UK

Re: Msgbox font size

16 Mar 2017, 14:11

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.
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
User avatar
MilesAhead
Posts: 232
Joined: 03 Oct 2013, 09:44

Re: Msgbox font size

16 Mar 2017, 16:10

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:
"My plan is to ghostwrite my biography. Then hire another writer to put his
name on it and take the blame."

- MilesAhead
User avatar
jeeswg
Posts: 6902
Joined: 19 Dec 2016, 01:58
Location: UK

Re: Msgbox font size

16 Mar 2017, 18:54

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.
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
toolman59
Posts: 3
Joined: 06 Mar 2017, 01:25
Location: United Kingdom

Re: Msgbox font size

20 Mar 2017, 02:46

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
LAPIII
Posts: 668
Joined: 01 Aug 2021, 06:01

Re: Msgbox font size

05 Feb 2022, 18:43

Where can I get MsgBoxGui.ahk? I want to change the font in a message box.
User avatar
boiler
Posts: 16951
Joined: 21 Dec 2014, 02:44

Re: Msgbox font size

05 Feb 2022, 18:50

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.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Descolada, inseption86, mikeyww and 447 guests