classic look of windows tab control in unicode MFC program?

103 views Asked by At

I am working on an MFC dialog based program with CTabCtrl (VS2017, W10). Everything works as expected, apart from the way tabs look (convoluted story, don't ask).

I need them to look like on the right, but when I created a new project with a CDialogEx based class and added tabs to the dialog (just the standard VS/MFC stuff, nothing fancy yet) they looked like the ones on the left. What I found after some testing and comparing with older projects is that if I switch in project defaults Character Set from Unicode to Multi-Byte Character Set I get the look I want (yes, sounds completely unrelated, but checked and rechecked several times). But that's ridiculously inconvenient, program needs to work with different languages and uses Unicode libraries for managing the data.

No idea if the problem is really MFC related, could be some deeper Windows thing.

Any idea what can be done to get the right look (pun intended), other than implementing my own OwnerDraw() or adding an additional layer of code to translate between data in Unicode and MBCS? Both approaches sound pretty off.

1

There are 1 answers

0
Borek On

Just if someone gets here looking for an answer: turned out it was a problem with different default windows themes being used depending on the character set selected. In the end adding

CWnd *ctl;
ctl = GetWindow(GW_CHILD);
while (ctl)
{
    SetWindowTheme(ctl->m_hWnd, L" ", L" ");
    ctl = ctl->GetNextWindow();
}

to OnInitDialog() made all the controls in the dialog look like I wanted to, even after switching to Unicode.