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?

  • Resources are leaking, but in general they should draw normally. Are you sure that SetBackground is SetBackground called? and then the thread gets into the WM_ERASEBKGND handler? - VTT
  • @VTT where do they leak? - Mike Waters
  • As where? pen and brush must be removed, first making active in the context those objects that were in it before selecting these pen and brush - VTT
  • @VTT, I get it, I create a window object, setBackground is called and the message loop goes on - Mike Waters 10:06 pm
  • @VTT I don’t know how to check the hit in the stream, everything seems to work in one stream - Mike Waters

0