winapi

Determine windows system wide font


What is the Win32 API call to determine the system-wide font (in particular the color) for say Menus.

This would be equivalent to going into Appearance Settings - Advanced - and then choosing Menu as the item to look at.

I can use GetSysColor to find the colors of various system-wide window elements, but cannot find the equivalent for fonts.


Solution

  • GetSysColor(COLOR_MENUTEXT) gives you the menu font colour.

    SystemParametersInfo Will allow you to recover some font information, likewise GetStockObject for drawing on the device context.

    But the system font is (probably) either Tahoma (on XP/W2K) or MS Sans Serif depending on how you set up your Dialog.

    See https://devblogs.microsoft.com/oldnewthing/20050204-00/?p=36523 for more.