win32 screensaver

i have a screen saver that "bounces" an image around teh screen. currently, as it moves the area behind it doesn get redrawn so it leaves a trail behind it. All i want is for the screen to be painted black each WM_PAINT, and then to move the image over. what's the easiest wayto do this w/o flicker?

The essence of Christianity is told us in the Garden of Eden history. The fruit that was forbidden was on the Tree of Knowledge. The subtext is, All the suffering you have is because you wanted to find out what was going on. You could be in the Garden of Eden if you had just kept your f***ing mouth shut and hadn't asked any questions.

thanks, that was a much easier solution than the crazy hack i was running... i have a new problem now, i thought that by drawing the whole screen into a temp HDC and then BitBlt()'ing that whole completed HDC onto my screen's HDC i would be making the animation smoother. but instead its choppier, here is my code:
btw the refresh rate is 20 frms/second and i offset the bmp +3 x/y each time

I think you should not create the dc, bitmap and select and so on on each frame. Instead do it at the beginning of the program and destroy them at the end. Probably this steals your time. Ressource allocation is always expensive.

You are selecting in the bmp over and over again. This is a problem as you will loose the original BMP.

Are the variables all static in the callback?

All painting to the HDC's should have been compleated BEFORE the app calls for a WM_PAINT.
The area that needs repainting should be determined before a call to BeginPaint() with GetUpdateRect() . Only this rect should then be repainted to increase speed.

Remember that other events (like a messagebox appearing) can make the OS call for a paint.

this is my standard paint function. The hdc is assembled from many smaller ones. If a paint msg arrives while the app is redrawing the screen it redraws the last frame. When the new frame is assemble it is Blited to the screen buffer and I call InvalidateRect() with the area redrawn.

The essence of Christianity is told us in the Garden of Eden history. The fruit that was forbidden was on the Tree of Knowledge. The subtext is, All the suffering you have is because you wanted to find out what was going on. You could be in the Garden of Eden if you had just kept your f***ing mouth shut and hadn't asked any questions.