Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Modeless Dialog Boxes and UpdateData()

Posted on 1997-12-17
4
Medium Priority
?
352 Views
Last Modified: 2012-06-21
I am using Microsoft Visual C++ 4.0 Standard Edition.  I am
using a modeless dialog box to display status of the
processing.  The dialog box is declared and displayed as
follows:

MAutotest_status  * progress_box;
.
.
.
progress_box = new MAutotest_status;
progress_box->Create();

The processing involves looping several times.  In each loop
variables associated with edit boxes get changed.  To
display these, the code used is:

progress_box->m_SCmd_att = ser_cmd_att;                                                progress_box->UpdateData(FALSE);

where ser_cmd_att is a local variable.  

My problem is this:  the values do not get updated on the
screen with each loop.  The loop involves several reads
and writes on COM1.  The data gets updated with the final
value after the processing is complete rather than at the
end of each UpdateData statement.  The UpdateData is getting
executed and is returning a value of 1.  Also the problem is
not that it is getting updated so quickly that I cannot see except the final value.  Each loop takes quite a while.  I
would appreciate if someone could explain what the problem
is.  Thanks.
0
Comment
Question by:raghu022597
[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
  • 2
  • 2
4 Comments
 
LVL 15

Accepted Solution

by:
Tommy Hui earned 400 total points
ID: 1176566
Right after progress_box->UpdateData(FALSE), use

  AfxGetApp()->PumpMessages();

to allow the dialog some time to update its screen.


0
 

Author Comment

by:raghu022597
ID: 1176567
Thanks.  What is PumpMessages() supposed to do?  If
I have to implement it as a delay, where is it supposed
to be?  
0
 
LVL 15

Expert Comment

by:Tommy Hui
ID: 1176568
Look in the source code thrdcore.cpp in \vc\mfc\src to see what it does. Basically it is a message loop. It pumps messages out of the message queue and processes them.
0
 

Author Comment

by:raghu022597
ID: 1176569
Thank you very much!  It is PumpMessage() and not
PumpMessages() and that is the reason I was confused, since
it did not recognize the function the first time around!
But now it works just fine.  Thanks once again.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.

660 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