case WM_ERASEBKGND: { HPEN pen; HBRUSH brush; RECT rect; pen = CreatePen(PS_SOLID, 1, this->background); brush = CreateSolidBrush(this->background); SelectObject((HDC)wParam, pen); SelectObject((HDC)wParam, brush); GetClientRect(hwnd, &rect); Rectangle((HDC)wParam, rect.left, rect.top, rect.right, rect.bottom); break; } case WM_PAINT: { hdc = BeginPaint(hwnd, &ps); // TODO: Add any drawing code here... EndPaint(hwnd, &ps); break; } and
bool Window::SetBackground(COLORREF background) { this->background = background; InvalidateRect(this->hwnd, NULL, TRUE); return true; } Why does calling the method (after creating the window) not change the Background window?
SetBackgroundisSetBackgroundcalled? and then the thread gets into theWM_ERASEBKGNDhandler? - VTTpenandbrushmust be removed, first making active in the context those objects that were in it before selecting thesepenandbrush- VTT