-
Wm_paint
When the window is moved, resized, obstructed by another window, etc... windows will send your application a WM_PAINT message in order for you to redraw the invalid region.
case WM_PAINT:
{
// hdc = BeginPaint(hwnd, &paintstruct);
// EndPaint(hwnd);
} break;
For a test, I commented the lines of code out to see what would happen. When I ran my simple program (It just displays a blank window.), I could still resize, move, etc.. and it still redrew the window. Why is this? Does windows do something I'm not aware of? Please help!
Thanks,
Codah
-
I'll give yah a hint: You don't een have to trap a WM_PAINT. Unless you keep windows from doing so somehow, it will always repaint the window.
-
So you would only use WM_PAINT if you wanted to do some specific drawing tasks? In other words, windows will always do the basic drawing job?
-
Windows will redraw ctrls and dlg's as long as they are not 'ownerdraw'. Other drawing must be handled. Anything in a HDC must be 'ownerdrawn'.
In between beginpaint() and endpaint() you put the code you want executed when repainting.
BeginPaint() only validates a region that has had paint called on it with InvalidateRect, UpdateWindow ect.
EndPaint cleans up.