WM_GETFONT returns NULL
-
I need to get the font of a static control, but the documentation says WM_GETFONT will return null if the control is using the system font. How can I get the system font? [Edit] I see GetStockObject can return the font, but there are many options. Which one of those do I need: DEVICE_DEFAULT_FONT Windows NT/2000/XP: Device-dependent font. DEFAULT_GUI_FONT Default font for user interface objects such as menus and dialog boxes. This is MS Sans Serif. Compare this with SYSTEM_FONT. OEM_FIXED_FONT Original equipment manufacturer (OEM) dependent fixed-pitch (monospace) font. SYSTEM_FONT System font. By default, the system uses the system font to draw menus, dialog box controls, and text. Windows 95/98 and Windows NT: The system font is MS Sans Serif. Windows 2000/XP: The system font is Tahoma SYSTEM_FIXED_FONT Fixed-pitch (monospace) system font. This stock object is provided only for compatibility with 16-bit Windows versions earlier than 3.0.
There is sufficient light for those who desire to see, and there is sufficient darkness for those of a contrary disposition. Blaise Pascal
-
I need to get the font of a static control, but the documentation says WM_GETFONT will return null if the control is using the system font. How can I get the system font? [Edit] I see GetStockObject can return the font, but there are many options. Which one of those do I need: DEVICE_DEFAULT_FONT Windows NT/2000/XP: Device-dependent font. DEFAULT_GUI_FONT Default font for user interface objects such as menus and dialog boxes. This is MS Sans Serif. Compare this with SYSTEM_FONT. OEM_FIXED_FONT Original equipment manufacturer (OEM) dependent fixed-pitch (monospace) font. SYSTEM_FONT System font. By default, the system uses the system font to draw menus, dialog box controls, and text. Windows 95/98 and Windows NT: The system font is MS Sans Serif. Windows 2000/XP: The system font is Tahoma SYSTEM_FIXED_FONT Fixed-pitch (monospace) system font. This stock object is provided only for compatibility with 16-bit Windows versions earlier than 3.0.
There is sufficient light for those who desire to see, and there is sufficient darkness for those of a contrary disposition. Blaise Pascal
We've been using GetStockObject(DEFAULT_GUI_FONT) and that has worked from Win95 to Windows 7. What do you need it for?
AxisFirst For Business
-
We've been using GetStockObject(DEFAULT_GUI_FONT) and that has worked from Win95 to Windows 7. What do you need it for?
AxisFirst For Business
Thanks. I derive a class from cstatic with functions for changing font size and name. I do it by calling CWnd::GetFont, changing what I need and then calling CWnd::SetFont
There is sufficient light for those who desire to see, and there is sufficient darkness for those of a contrary disposition. Blaise Pascal