Advertisement

Question about windows

Started by January 07, 2003 09:11 PM
2 comments, last by Space_Panda 21 years, 10 months ago
Does anyone know how to stop your primary surface from going black when the windowed application is not active and another window goes over it. When that other window gets moved around it the area it was over is now black. Is there any way to fix this? When I do set it back to active it of course begins again and starts applying the surface.
Your window''s WndProc will receive a WM_PAINT message, allowing you to redraw the newly revealed area. The OS is painting it black because you probably used a black background brush in your WNDCLASS structure.

This is rudimentary Windows programming material and is covered in the MSDN docs as well as a number of Windows programming books on the market. Look at the docs for WM_PAINT.
Advertisement
I knew it was WM_PAINT and I tried using WM_PAINT to GetUpdateRect and find the rectangle that needed to be updated and draw the surface in this area but it causes the screen to be updated everywhere. What I was asking was constructive info like do I use GetUpdateRect and use the co-ordinates I get from that to update? Oh and it may be "rudimentary" but I believe this forum is called "For Beginners". So Basic questions should be allowed and not be treated with disdain.
hey Space_Panda, is your project GDI, DX, OGL, SDL? and is it a frame-by-frame type or is the display fairly static?

you should be able to use GetUpdateRect within the context of a WM_PAINT handler to retrieve the update rect, but there are other ways to go about it, such as using BeginPaint/EndPaint, which will do some of the "leg work" for you (getting a DC, setting the clip region, posting WM_NCPAINT and/or WM_ERASEBKGND msgs if needed, etc.)

but this typically is not necessary for a game-type project that is doing frame-by-frame updating. normally you would just call your render function(s) here to do a full frame update.

but before i go into any further detail i''d like to know what type of project you''re working on and what you meant by "it causes the screen to be updated everywhere". are you saying the rect returned from GetUpdateRect was invalid or something else?

This topic is closed to new replies.

Advertisement