You can paint anywhere in the window. Begin/EndPaint() are just
used to 'redraw' an invalidated area. If you want to 'redraw' the
entire area, you can call InvalidateRect() before Begin/EndPaint()
Code:
BOOL InvalidateRect(
HWND hWnd, // handle of window with changed update region
CONST RECT *lpRect, // address of rectangle coordinates
BOOL bErase // erase-background flag
);
You'd first need to create a RECT that holds the coordinates of
the client area of your window. Use GetClientRect()
Code:
BOOL GetClientRect(
HWND hWnd, // handle to window
LPRECT lpRect // address of structure for client coordinates
);
Code:
LRESULT CALLBACK WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
HDC gdc;
RECT ClientArea;
PAINTSTRUCT ps;
GetClientArea(hwnd, &ClientArea);
switch(msg)
{
case WM_PAINT:
InvalidateRect(hwnd, &ClientArea, false);
gdc = BeginPaint(hwnd, &ps);
EndPaint(hwnd, &ps)
return 0;
break;
default:
break;
}
return (DefWindowProc(hwnd, msg, wParam, lParam));
}
Or something like that. Maybe... I don't know.