Solved

UpdateAllViews - OnDraw Lags

Posted on 2006-11-02
1
297 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
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
MFC Dialog 9 48
Show shut-down message as Windows 8 shuts down. 9 85
Best tools for Backup and restore of Wordpress site 6 55
bigDiff challenge 17 84
Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
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.
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.

867 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

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now