My understanding is as follows:
When a window needs painting, the procedure calls WM_PAINT. If there is no handler for this message, the message is passed to DefWindowProc which takes care of the default painting of the window.
When a handler is present, it intercepts the message and executes the code within the handler. Then, instead of calling DefWindowProc, the window procedure then returns 0Code:LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { switch(msg) { ... default: return DefWindowProc(hwnd, msg, wParam, lParam); } return 0; }
So my question is, if WM_PAINT is not being handed to DefWindowProc, when and how is the window actually drawn?Code:LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { switch(msg) { case WM_PAINT: { HDC hdc; PAINTSTRUCT ps; hdc = BeginPaint(hwnd, &ps); ... EndPaint(hwnd, &ps); } break; default: return DefWindowProc(hwnd, msg, wParam, lParam); } return 0; }



LinkBack URL
About LinkBacks


