Re: Drawing continuously(dynamically) in MFC .
I'm not sure if I understand exactly what you want but you should definitely
avoid a loop in OnDraw() if that is what you are asking.
The first thing I would do is optimize OnDraw() so that it is very efficient
by being able to draw only the data that's changed, and scrolling the window
contents if needed rather than simply redrawing the entire screen. Use the
Hint argument if at all possible.
Second, then call OnUpdate()/OnUpdateAllViews() whenever the data changes.
This could be called whenever you receive new data. Or, if that's not
possible, use a timer handler that calls the update routine.
You definitely need to coorperate with the Windows model of handling events.
An endless loop anywhere in your main thread would definitely be bad. But,
if for some reason the above approach doesn't work for you, you could also
consider creating a worker thread that loops. It would have to constantly
test some variable to see if it should stop that the rest of your program
<firstname.lastname@example.org> wrote in message
I have to develop an application in which I would like to paint the
screen (view/dialog) as long as the application exists. I am recieving
some data from the below layers and I should paint the screen
accordingly. In betwwn user may click on the screen , can change the
color of the line I have drawn etc.
Correct me If I am wrong..If I draw my screen from OnPaint or OnDraw()
my application would hang and I want to handle other events also so
this option is ruled out.
So what may be the solution , I have to remember what I have drawn
using some data structure and tell Onpaint function to draw those
everytime it gets called ?
or is there any other better way of doing that?
Please post a link to a sample if u have .