Archive: runtime equivalent to SetFont?


runtime equivalent to SetFont?
Hi,

How can I change the font for the whole installer at runtime? Something like using SetFont, but SetFont is compile time only.

Thanks! :)


You should be able to send WM_SETFONT with SendMessage to $HWNDPARENT

-Stu


can that change all the installer controls fonts?


Just tried it, i would need to send the message to each and every control manually...

NSIS is obviously remember what is set with SetFont at compile time and applying it whenever it creates controls, so there should be a way to change it at runtime.


It doesn't change the font on its own with SetFont. It changes the dialog resource. When the dialog creation function is called, it reads that resource and applies the correct font. There's no API to apply a different font, probably because the font affects the size of the new window. You'll have to manually set it to every control.


There is no way to specify a font before the GUI is loaded?

So if we want to change the font, we could change that variable and restart the installer

Im not sur ehow we could feed the variable to the installer, maybe commandline, or a resource in the installer, etc


If you really want, you could pack the installer in another installer that'd modify the resource to change the font before it starts the packed installer. You might be able to use Resource Hacker to change the font from the command line.


Good idea, I will look into it...

Changing the whole installer font would be great, because if you ever run an NSIS installer on a large resolution, its impossible to read it and NSIS does not adjust to the windows font size settings.

Anhy other ideas would be great


I have attached an example of how the InstallShield wizard adjusts everything to the Windows system font settings, this is on a fairly high resolution.