I'm new to windows programming and I have a question about painting the windows, specifically about BeginPaint function
When I was reading about it on MSDN it says that
Start the painting operation by calling the BeginPaint function. This function fills in the PAINTSTRUCT structure with information on the repaint request. The current update region is given in the rcPaint member of PAINTSTRUCT.
my question is when I handle the WM_PAINT message in my wndproc and start by calling BeginPaint function, I didn't provide this function with any data about the particular message I received or the update region that needs to be painted, So how does this function fill the PAINTSTRUCT including the invalid rect "rcPaint member" ?!
case WM_PAINT:
{
PAINTSTRUCT ps;
HDC hdc = BeginPaint(hwnd, &ps);
// All painting occurs here, between BeginPaint and EndPaint.
EndPaint(hwnd, &ps);
}
and when I referenced BeginPaint function on MSDN, It says
An application should not call BeginPaint except in response to a WM_PAINT message
My guess is may be this function gets this information internally from Windows by requesting for this information and the last WM_PAINT message sent to the window that I passed it's handle "`hwnd'" as the first parameter to the function. Is that correct ?
thanks in advance.