🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

WM_PAINT

Started by
0 comments, last by mago 22 years, 7 months ago
hi could anybody help me with this newbie question? Every time I catch a WM_PAINT message, it looks something like this: case WM_PAINT: InvalidateRectangle... hDC = BeginPaint... // do the drawing here EndPaint... break; Now do I have to register all the pens and brushes with the hDC again every time the WM_PAINT is being handled? Or, if I don''t intend to change them throughout the whole program, is there a way to do it once just at the beginning so it doesn''t slow down the processing of WM_PAINT? Mago
thanx for sharing
Advertisement
Windows is a stupid operative system ( ¿¿WHAT?? ¿¿WINDOWS?? ¿¿AN OPERATIVE SYSTEM?? AH, AH, AH... ) and so on it makes stupids things, and one of that things are not guarantee that the device context passed to your window in one WM_PAINT message being the same device context that will pass to your window in the next WM_PAINT message. That''s the reason why you can''t store the hDC handle between WM_PAINT messages, and that''s the reason why you must create the pens, brushes and other Device objects every time you receive a W_PAINT message.

There is a way to solve that problem, and is to register the class of the window with the style CS_OWNDC. With this style, you can create the device objects only once (after created the window, of course).



"If you''''re gonna die, die with your boots on"
"If you''re gonna die, die with your boots on"

This topic is closed to new replies.

Advertisement