The proposed code segment does not seem to work for either MFC dialogs or MFC programs. When used in a FrameWindow it crashes at the place with the font, because there a null pointer which is not queried.
I have already tried a few things to change colors with simple means. The title bar seems to be especially protected against changes.
There are probably 3 possibilities:
1. Completely disable the themes for the window.
I already suggested to disable the visual styles with SetWindowTheme().
2. Define a theme which has the desired look:
HTHEME hTheme = OpenThemeData();
In Windows Vista and later, the appearance of the non-client areas of application windows (the title bar, icon, window border, and caption buttons) is controlled by the DWM.
Sample: Custom Window Frame Using DWM
Appendix B: Painting the Caption Title
The following code demonstrates how to paint a caption title on the extended frame.
https://learn.microsoft.com/en-us/windows/win32/dwm/customframe#appendix-b-painting-the-caption-title
3. As far as OWNER_DRAWN is still possible you can draw everything yourself. Probably not suitable for MFC.