We help IT Professionals succeed at work.

Modeless Dialog Boxes and UpdateData()

raghu022597
raghu022597 asked
on
Medium Priority
369 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.
Comment
Watch Question

Engineer
Commented:
Right after progress_box->UpdateData(FALSE), use

  AfxGetApp()->PumpMessages();

to allow the dialog some time to update its screen.


Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts

Author

Commented:
Thanks.  What is PumpMessages() supposed to do?  If
I have to implement it as a delay, where is it supposed
to be?  
Tommy HuiEngineer

Commented:
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.

Author

Commented:
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.
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.