You can use SystemParametersInfowith parameter SPI_GETNONCLIENTMETRICSto get the current font. SystemParametersInfo will keep track of the current topic and provide font information for captions, menus, and message dialogs. (See Note to GetStockObject http://msdn.microsoft.com/en-us/library/dd144925(VS.85).aspx ). The function will retrieve a structure NONCLIENTMETRICS(see http://msdn.microsoft.com/en-us/library/ff729175(v=VS.85).aspx ) that contains all the necessary information:
typedef struct tagNONCLIENTMETRICS {
UINT cbSize;
int iBorderWidth;
int iScrollWidth;
int iScrollHeight;
int iCaptionWidth;
int iCaptionHeight;
LOGFONT lfCaptionFont;
int iSmCaptionWidth;
int iSmCaptionHeight;
LOGFONT lfSmCaptionFont;
int iMenuWidth;
int iMenuHeight;
LOGFONT lfMenuFont;
LOGFONT lfStatusFont;
LOGFONT lfMessageFont;
int iPaddedBorderWidth;
} NONCLIENTMETRICS, *PNONCLIENTMETRICS, *LPNONCLIENTMETRICS;
An example of creating and installing a font in a window / control, if you know the parameter LOGFONT, see the end of the example for changing the default window font in the win32 windows project , but use LOGFONTnot from GetStockObject(DEFAULT_GUI_FONT), but instead return SystemParametersInfowith the parameter SPI_GETNONCLIENTMETRICS.