Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

UpdateAllViews - OnDraw Lags

Posted on 2006-11-02
1
Medium Priority
?
352 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 1500 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

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

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

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.
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Suggested Courses

650 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