Flicker in GDI

I went through several tutorials covering double buffering and flickerless GDI animations. I just cant get them to work. Every time i render, there is alot of flicker because I have to erase the entire screen and redraw everything on to it. switching to OpenGL or directX is not an option (due to time constriants etc).

The way i traied it was to catch WM_ERASEBKGND and do my own erasing when i render. this still causes flicker regardless. Anyone have any explanation why this is happening to me??

Im not worried about efficiency just yet. I will do as you suggested, but once the problem has been fixed.
The window is crated without using a background brush. I erase the background manually inside the render function.

Why would you need to erase the on-screen copy if you're just going to copy all over it with the new data?

Im not drawing to the whole screen all the time, else i wouldnt bother with erasing the background. the code where im erasing the background is basically just painting the window a certain color before i start painting the "panels" onto the screen.

Haven't we already done this? As the Catch22 article says, the rule to avoid flicker is: You must never draw over the same pixel twice. I suggest you try:
- Call ExcludeClipRect after painting every bitmap with the same coordinates.
- Paint the background after the bitmaps have been painted. Having excluded them from the clipping region, they will not be painted over.