I'm not sure what am I doing wrong. I have a functionality in my CDialog-based MFC app to increase the font in some common controls. It is done by sending them WM_SETFONT message with a larger font:
//No error checks for brevity
HFONT hFnt = (HFONT)::SendMessage(hCtrlWnd, WM_GETFONT, 0, 0);
LOGFONT lfFont;
::GetObject(hFnt, sizeof(lfFont), &lfFont);
BOOL bPositive = lfFont.lfHeight >= 0;
long nFontSz = abs(lfFont.lfHeight);
nFontSz += nFontDelta;
lfFont.lfHeight = bPositive ? nFontSz : -nFontSz;
HFONT hNewFont = ::CreateFontIndirect(&lfFont);
::SendMessage(hCtrlWnd, WM_SETFONT, (WPARAM)hNewFont, TRUE);
//Need to DeleteObject hNewFont when control gets a new font or is destroyed
This works for most controls except the DateTime picker (or to be more precise, its month-calendar, SysMonthCal32 window class.)
Here's a screenshot on Windows XP, where it works as expected:
Normal magnification:
Enlarged:
But here's what I get on Windows 10, normal magnification:
And (supposed to be) enlarged, but isn't:
So why is it working on XP and stops, starting from Vista onward?




You are probably using ComCtl32.dll version 6 which uses the Visual Styles API.
This means that most text is drawn by either
DrawThemeTextorDrawThemeTextEx.Both of these functions use the font specified by the
HTHEMEargument.To change the font you could either change the window's theme using
SetWindowThemeor use a version of ComCtl32.dll prior to version 6.The handling of
WM_SETFONTandWM_GETFONTseems to be for keeping compatibility with programs that use these messages to store their font. They are not actually used for drawing.