Current version

v1.10.4 (stable)


Main page
Archived news
Plugin SDK
Knowledge base
Contact info
Other projects


Blog Archive

Alright, who forgot to send WM_SETFONT?

One of the features I like from Windows 7 is the Win+P shortcut, which brings up dual-monitor settings:

[Windows projector mode dialog with System font]

I like this because otherwise I have to use the Fn+F8 shortcut to cycle through multi-mon modes, and it takes several seconds for the displays to reinit every time I cycle to a different mode. Any UI procedure that involves me having to wait seconds for something to happen multiple times sucks. This way, I only take the mode switch hit once.

There's only one problem with it, though: it's using the default System font, which on the ugly scale is eclipsed only by Chicago and Topaz.

Admittedly I'm asking for it by using the Classic theme -- it looks fine with Aero -- but it's one of those small things that catches my eye, kind of like dialog buttons that don't line up. I'm guessing someone didn't bother to send the WM_SETFONT message, which is normally how you end up with this situation. The System font is the default font you get when you create a Win32 button control manually, and you have to change it manually to GetStockObject(DEFAULT_GUI_FONT) or some other UI font. Fortunately, dialogs do this automatically, so most of the time this isn't a problem, except when you're doing something tricky like dynamically creating layouts.

(Inevitably whenever I've posted something like this, someone immediately posts a snarky comment pointing out where I've forgotten to do the same thing myself. Bring it on!!!)


This blog was originally open for comments when this entry was first posted, but was later closed and then removed due to spam and after a migration away from the original blog software. Unfortunately, it would have been a lot of work to reformat the comments to republish them. The author thanks everyone who posted comments and added to the discussion.