I’m writing a Win32 application using plain C and WinAPI. No MFC or C++ is allowed. To get the controls to draw using the appropriate style, I use a manifest, as described in the corresponding MSDN article. Everything is fine, and when I change the system style, my application changes style as well. But the font used is just ugly. How do I force the application to use the standard system font?
Share
You can use
SystemParametersInfowithSPI_GETNONCLIENTMETRICSparameter to retrieve the current font. SystemParametersInfo will take into account the current theme and provides font information for captions, menus, and message dialogs. (See remark toGetStockObjecthttp://msdn.microsoft.com/en-us/library/dd144925(VS.85).aspx). The function will retrieveNONCLIENTMETRICSstructure (see http://msdn.microsoft.com/en-us/library/ff729175(v=VS.85).aspx) which contains all information you needs:An example how to create and a set font in a window/control if you knows
LOGFONTparameter see at the end of the example from change the default window font in a win32 windows project, but use doLOGFONTnot fromGetStockObject(DEFAULT_GUI_FONT), but returned bySystemParametersInfowithSPI_GETNONCLIENTMETRICSparameter instead.