I have read that I should never send WM_PAINT
manually and should call InvalidateRect
instead but didn't found anything about why not, however. So why not?
update works with InvalidateRect
but not with SendMessage(WM_PAINT)
LRESULT CALLBACK window_proc(HWND wnd, UINT msg, WPARAM w_param, LPARAM l_param)
{
switch (msg)
{
case WM_PAINT:
PAINTSTRUCT ps;
HDC hdc = BeginPaint(wnd, &ps);
Polyline(..);
EndPaint(wnd, &ps);
return 0;
case WM_USER:
// SendMessage(wnd, WM_PAINT, NULL, NULL);
// InvalidateRect(wnd, NULL, FALSE);
return 0;
}
}
InvalidateRect
, thenBeginPaint
says "Oh, the window is still valid. There is no need to paint anything." – Perfunctory