0

How to define a system theme to be applied that matches the new style and apply it. Please find the attached image for the actual and expected style.

MDI Frame window color:

enter image description here

The following approaches i have tried so far, it was not yielded expected result.

1: Setting Application caption using Windows API The following code sets the color for application title bar for the session. But with theme settings and such on Windows 8.1 and 10, it does not come into effect.

int aElement = COLOR_ACTIVECAPTION;
DWORD aOldColor;
DWORD aNewColor; 
aOldColor = GetSysColor(aElement);
aNewColor = RGB(0x04, 0x04, 0x04);
SetSysColors(1, &aElement, &aNewColor);

2: Using theme/DWM API

With a Windows theme in effect, changing the application title bar alone does not become successful. Have tried:

2-a: Getting theme handle, defining a captionbar and using the captionbar in a call to CMFCVisualManager::GetInstance()->OnDrawCaptionBarBorder()

2-b: DwmSetWindowAttribute() was used for setting rendering policy disabled.

3: Using CMFCVisualManager

Defining a CMFCCaptionBar and assigning it to CMFCVisualManager. This too does not get the effect needed.

Barmak Shemirani
  • 30,904
  • 6
  • 40
  • 77
  • If everything else fails, you might need to handle WM_NCPAINT for the MDI frame and draw it yourself. – VuVirt Oct 02 '17 at 15:53
  • http://www.codeguru.com/cpp/frameworks/advancedui/article.php/c3215/Framework-for-Creating-Custom-Window-Captions.htm – VuVirt Oct 03 '17 at 07:30
  • The above approach mentioned in the link didn't work for me. – Lenin MV Oct 03 '17 at 10:45
  • See my comments https://stackoverflow.com/questions/11673801/how-to-skin-mfc-main-menu#comment62753981_11673801 and https://stackoverflow.com/questions/41996087/how-to-change-mfc-application-ui#comment71552882_41996087 – sergiol Nov 29 '17 at 17:12

0 Answers0