Link to home
Start Free TrialLog in
Avatar of milindsm
milindsmFlag for India

asked on

MFC Dialog

Hello,

I have MFC dialog  that has Next and Back buttons on it. It also has 4 child dialogs out of which one has a progress control on it.

When this particular dialog appears, I would like to start a progress bar and keep changing the static control above it with messages like "Initializing...", "installation started", "Finished" etc.

As I go on changing the text on the static control, parent dialog kind of hangs. Next & Back buttons partially appear (they don't get repainted properly). Once the progress function is finished, everything comes to normal state.

Can anybody tell me how should I show progress on a static control keeping my parent form movable, re-sizable etc.  
ASKER CERTIFIED SOLUTION
Avatar of pgnatyuk
pgnatyuk
Flag of Israel image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Avatar of AndyAinscow
AndyAinscow
Flag of Switzerland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
This is like managing applications Cache Management. Do not put so many thing (E.G. UI Customisation, Reloading the other views, loading sub windows ete.) to your Initdialog functions or any common method which is used by your application. This is the only reason that your application is in astate of temporary hung.
Launch your child dialogs as a Modeless dialog boxes instead of Modal. This allows you to have your child dialog work separately as well as let you to interact with the parent dialog. Regarding the hung, try putting Sleep(1000) inside the loop where you are incrementing the progress of a progress bar. I guess the temporary hung is because you are making the processor to run your loop very fast. Sleep allows the processor to concentrate on other threads and hence there will be no hung.
Avatar of mcbSolutions
mcbSolutions

If you like to install something use InnoSetup and you will not spend a lot of time by reinventing the wheel.

http://www.jrsoftware.org/isinfo.php

kind regards
There are good and bad answers here.  The one by AndyAinscow is good.  The one suggesting using Sleep() is bad.  (Almost all uses of Sleep() are kludges and in this case I do not believe it will work.)
I've requested that this question be deleted for the following reason:

                           
No comment has been added to this question in more than 21 days, so it is now classified as abandoned and is now flagged for deletion.


If there is a valid solution, please OBJECT and indicate the comments that are, or would otherwise lead to, a solution.


Use the specific format http:#axxxxxxxx for comment ID(s).


Also, please don't object simply because the author did not respond to your comment. While we understand this is frustrating, unfortunately we cannot force the author to return to the question. Unless you feel you have presented a valid, verifiable solution we'll simply delete the question.


Experts-Exchange Auto Deleter
Split between
http:#a32967724
http:#a32967735
both methods will work.  The second is simpler to implement but the first is 'better' overall.