Hi, I'm having confusion with the effect of the return value of WM_CTLCOLORSTATIC with read only edit controls.
In my main WndProc's WM_CREATE's handler includes:
Which should create a read only edit control.
hwndInfoEdit = CreateWindowEx(NULL, TEXT("edit"), NULL, WS_CHILD | WS_VISIBLE |
ES_MULTILINE | ES_AUTOVSCROLL |
ES_READONLY, 25, 25, 25, 25, hWnd, NULL,
((LPCREATESTRUCT)lParam) -> hInstance, NULL);
I also handled WM_CTLCOLORSTATIC in the same WndProc:
The MessageBeep did play a beep, so I'm sure the return line after that did run.
HDC hdcStatic = (HDC)wParam;
HWND hwndStatic = (HWND)lParam;
if(hwndStatic == hwndInfoEdit)
But for some reason, the edit control's background color is white. I returned a handle to a black brush, so why did it turn out white? I replaced BLACK_BRUSH with GRAY_BRUSH and a few other values, but it still makes the background color white.
I tried including a SetBkColor(hdcStatic, RGB(0,0,0)); before the return and that made the background black, but I'm trying to understand why I can't use the return to get a black background.
Please reply, any help is greatly appreciated.