I was just reading about the WM_PAINT message and it was talking about the ways to go about getting, making, setting the invalid rectangle of the client area. By what it was explaining, I got this out of the first explanation (given hdc is defined as HDC):
Code:
case WM_PAINT:
{
hdc = BeginPaint(hwnd, &rect);
[GDI functions here]
EndPaint(hwnd, &rect);
return 0;
}
And then the book was trying to introduce other functions like InvalidateRect() and ValidateRect(). My book said InvalidateRect() would invalidate the whole client area to redraw the whole area. Would this function be used like this:
Code:
case WM_PAINT:
{
InvalidateRect(hwnd, NULL);
hdc = BeginPaint(hwnd, &rect);
[GDI functions here ]
EndPaint(hwnd, &rect);
return 0;
}
Then (this is where I got confused a little) it introduced the ValidateRect() function. Would this function be used like this:
Code:
case WM_PAINT:
{
GetDC(hwnd, NULL);
ValidateRect(hwnd, NULL);
ReleaseDC(hwnd, hdc);
return 0;
}
I'm now second guessing the parameters to some of these functions, but is this the general use of them? Please correct me if I'm wrong. Thanks.
--Garfield