Solved

UpdateAllViews - OnDraw Lags

Posted on 2006-11-02
1
315 Views
Last Modified: 2013-11-20
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 ) )
     {  
          ::TranslateMessage(&msg);
          ::DispatchMessage(&msg);
     }
}

void MyDoc::OnCommandRun()
{
     while(!stop_recv_flag)
     {
          status = read_bus (data);
          if (status == GOTDATA)
          {
               UpdateAllViews(NULL);    
          }  
          DoEvents();              
     }

     stop_recv_flag = 0;
}

Thanks!
0
Comment
Question by:DizZzM
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 22

Accepted Solution

by:
mahesh1402 earned 500 total points
ID: 17864301
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..

-MAHESH
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question