Win32 Using System Font

Mar 19, 2011 at 5:05am
closed account (o1vk4iN6)
Is there a way I can set all the fonts of all my windows/controls in my win32 program to use the default font of the system. Right now it just uses some thick bold font that isn't pleasing to the eyes.
Mar 19, 2011 at 9:32am
This is how i do it:
create font (you need to figure out witch is font that your system is using):
1
2
3
4
hFont = CreateFont(
		18, 0, 0, 0, FW_MEDIUM, FALSE, FALSE, FALSE, ANSI_CHARSET, 
		OUT_TT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, 
		DEFAULT_PITCH | FF_DONTCARE, L"Tahoma");

and then you create control:
1
2
hButton = CreateWindow(...);
SendMessage(hButton, WM_SETFONT, (WPARAM)hFont, TRUE);

Hope it helped.
Mar 19, 2011 at 9:47am
Topic archived. No new replies allowed.