When creating a control (e.g. an edit control) on the fly using CreateWindow, it usually starts out with an ugly (boldish sans serif) font.
Usually I wok around that by grabbing the parent dialog’s font, and setting it to the control – I can’t even say if this is a good idea.
How do I “legally” fetch the right font?
The “correct” way to get the font used in dialog boxes like message boxes, etc. would be via the
SystemParametersInfo()function:Don’t forget to destroy the font when the controls are destroyed:
You can look up the MSDN documentation for
NONCLIENTMETRICSandSystemParametersInfo()to see what other system-wide parameters you can retrieve.