UpdateAllViews - OnDraw Lags

Hi Experts,

Developing an application for grabbing data off a bus and displaying it (similiar to Ethereal but for a different protocol). Have the code below in my Doc class. The problem is when I do an updateallviews - my OnDraw() function is putting up a lot of text up on the screen (using a BitMap to avoid flicker) but theres tons of data coming in on the bus and the delay from the time I receive the data to the time it gets drawn on the screen is a few seconds.

Is there an obvious reason why the lag/delay is occuring - is there a simple solution to speed up the time from when I receive data to get it drawn up on the screen?

void MyDoc::OnCommandStop()
     stop_recv_flag = 1;

void MyDoc::DoEvents()
     MSG msg;  
     while ( ::PeekMessage(&msg, NULL, 0, 0, PM_REMOVE ) )

void MyDoc::OnCommandRun()
          status = read_bus (data);
          if (status == GOTDATA)

     stop_recv_flag = 0;

Who is Participating?
mahesh1402Connect With a Mentor Commented:
May be you can have a worker thread to receive / read bus data and from your thread function you may send message to your main application to update other views / information to display..

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.