Quote Originally Posted by 2kaud View Post
SetTextColor, SetBkColor etc take as parameter 1 a hdc which is available as wParam, so there is no need to use GetDC(). Just use

Code:
SetTextColor((HDC)wParam, inst->clrTextColor);
etc...
Also note that every time you process this message, you are creating a new brush without deleting the old brush. When a brush is no longer being used it should be deleted using DeleteObject(). See http://msdn.microsoft.com/en-us/libr...=vs.85%29.aspx

When this message is processed, is the value of inst->clrTextColor the value it is supposed to be? Have you checked with the debugger to make sure this value is right?

For my test program, the code
Code:
case WM_CTLCOLORSTATIC:
            {
                SetTextColor((HDC)wParam, RGB(200, 0, 0));
                SetBkColor((HDC)wParam, RGB(0,200,0));
        SetBkMode((HDC)wParam, TRANSPARENT);
        inst->clrBackColor = (UINT)GetStockObject(GRAY_BRUSH);
                return (LRESULT)inst->clrBackColor;
            }
produces red text on a transparent background. If the SetBkMode statement is commented out, it produces red text on a green background.
but i'm trying change the control\window backcolor