If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register or Login
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Re: Animation problem using double buffering

You create two bitmaps of the same size and bitdepth
one holds the active/visible frame
one holds the new frame you're working on

your OnPaint only blits the invalidated rect from the visible bitmap to the screen.

When your new frame is finished, you flip the pointers/handles to the 2 bitmaps so the "new frame" becomes the visible frame, and the previously visible frame now becomes the new frame bitmap you'll be working on.
Invalidate the entire screen, OnPaint will do the rest
Repeat above 3 steps until whatever end condition is reached.

Re: Animation problem using double buffering

Hi,
Thanks for your guidance. Sorry I am following the previous approach given in the link which says:

To get rid of the flickering, handle WM_ERASEBKGND and just return TRUE in it.
To get rid of the black, you need to paint the entire memory DC in the color you want before starting to paint your road etc. You can use FillRect for this.

I have added WM_ERASEBKGND. It has removed the flickering but the black color is there as mentioned in that post and the grey color window is also created which slowly engulfs the entire screen.
I dont know how to paint the entire memory DC???
Kindly guide me what should i do.

Re: Animation problem using double buffering

The parameter for SetTextColor() is of type COLORREF and specifies the colour of the text as an RGB colour value. If the compiler is complaining that 'm_crInActiveTabText' is an undeclared identifer, then you need to determine what colour the text here is required to be set and use that value.

All advice is offered in good faith only. You are ultimately responsible for effects of your programs and the integrity of the machines they run on.