We do not redefine the WM_CTLCOLORSTATIC message. There is no such line in our source code, and there is nothing similar in our message handlers.
We addressed this issue by overriding the WM_DRAWITEM message for tab controls to paint their contents with a gray background (standard for dialogs without tab controls), rather than a white background (standard for contents of tab controls).
brush = CreateSolidBrush(GetSysColor(COLOR_MENU)); FillRect(lpdis->hDC, &lpdis->rcItem, brush); SetBkColor(lpdis->hDC, GetSysColor(COLOR_MENU)); wtext = ToWideStrdup(c->u.tabcontrol.Tabs[lpdis->itemID].name); rect = lpdis->rcItem; rect.top += DlgMarginY - 1; rect.bottom += DlgMarginY; DrawTextW(lpdis->hDC, wtext, -1, &rect, DT_CENTER | DT_VCENTER); free(wtext); DeleteObject(brush);
This is obviously a workaround and not the correct answer to my question.
By the way, we initialize the “common controls”, of which, I believe, there is only one tab control using this code ... I don’t think this is due to a problem?
#pragma comment(linker, "/manifestdependency:\"type='win32' " \ "name='Microsoft.Windows.Common-Controls' " \ "version='6.0.0.0' " \ "processorArchitecture='*' " \ "publicKeyToken='6595b64144ccf1df' " \ "language='*'\"") ... hCommCtrl = GetModuleHandle("comctl32.dll");` if (hCommCtrl) { ptrInit = (TfcInit_fn) GetProcAddress(hCommCtrl, "InitCommonControlsEx"); if (ptrInit) { data.dwSize = sizeof(INITCOMMONCONTROLSEX); data.dwICC = ctrlClass; if (ptrInit(&data) ) gCommCtrlsInitialized |= ICC_TAB_CLASSES | ICC_BAR_CLASSES; } }
source share