If you want to color an edit control for instance, you'll have to process the WM_CTLCOLOREDIT message in the PARENT window procedure:
Note that a read-only or disabled edit control will send an WM_CTLCOLORSTATIC.
//Global scope COLORREF bkgCol = RGB(128, 128, 128); HBRUSH br = CreateSolidBrush(bkgCol);
case WM_CTLCOLOREDIT: SetBkColor((HDC)wParam, bkgCol); SetTextColor((HDC)wParam, RGB(0, 255, 0)); return ((LRESULT)br);
//Uppon destroy of window: DeleteObject(br);
All controls color messages: WM_CTLCOLOREDIT WM_CTLCOLORBTN WM_CTLCOLORDLG WM_CTLCOLORLISTBOX WM_CTLCOLORMSGBOX WM_CTLCOLORSTATIC |