Let me reveal to you that I don't know Windows

Started by
2 comments, last by milo 23 years, 11 months ago
Was just working on my flipCode contest entry (entry, that is, if I get it done in time) and noticed something that I don''t understand. First, a small bit of background on what I''m doing. I handle the WM_SIZE message by posting a WM_PAINT message. The WM_PAINT message is handled by calling BeginPaint(), then RenderFrame(), then EndPaint(). RenderFrame() is also called within the infinite loop comprimising the message loop in WinMain(). Thusly, it is called over and over. Now here''s what I don''t understand. I get a window filled with black if I comment out the WM_SIZE case. I did this in preparation for this program running full screen(i.e. why have WM_SIZE if resize isn''t possible). I''m currently running it windowed. If I uncomment the WM_SIZE case I get the image I expect. Checking with the debugger, WM_SIZE is only processed one time (unless I resize the window obviously). The image is dynamic and does change with input so I don''t have a static window after 1 frame being drawn. This is true even if I do start the program in full screen mode. What gives? Why can I call RenderFrame() over and over and see nothing, but a single WM_SIZE, leading to a single WM_PAINT, means I see my image? My best guess at this point is that BeginPaint() does something necessary, but I don''t know and that makes me grumpy. Go ahead. Make me feel stupid. Punk. Mike Roberts aka milo mlbobs@telocity.com
Advertisement
You should never post a WM_PAINT message to a window yourself. Use InvalidateRect instead.
Like I''ll believe you unless you tell me why.

Mike Roberts
aka milo
mlbobs@telocity.com
BeginPaint fills PAINTSTRUCT structure with paint information like the clipping area where update the client area. This update region is set by invoking the InvalidateRect() function or by the system when you modify the client area (creating, scrolling, sizing, moving ...).
By posting a WM_PAINT message directly, paint informations are not defined or inconsistent, I suppose ....

This topic is closed to new replies.

Advertisement