Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C++ MFC
I am working on an MFC application that ultimately loops through a number of simulation trials after a user has entered the necessary information. The user tells the application how many trials to run. I have the application running from a button which is in a ribbon. This works fine, but nothing is displayed on the screen and the only way you'd know it was running is in task manager. What I would like is for a box to pop up which displays to the user what number trial is running with a progress bar that resets each time a new trial (run) starts....any suggestions? I am using VS2010.
Posted 12-Sep-12 1:31am
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

You can put the MessageBox at the starting of the simulation loop itself. And do update the application UI before continuing. This way you can display the information about trails to the user.
 
The other solution is, fork a thread and run your trials in those separate threads. Keep synchronizing mechanism to update the information back to the main UI.
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

Make sure you run the simulation in a thread separate from the UI thread.
1. Define a custom message.
2. On simulation start up, supply a HWND of your choice (typically your progress dialog) to the thread.
3. Use PostMessage()[^]from your thread to post simulation progress to the window in your UI thread.
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 420
1 OriginalGriff 210
2 Kornfeld Eliyahu Peter 210
3 DamithSL 210
4 mukesh mourya 85
0 OriginalGriff 7,215
1 DamithSL 5,199
2 Maciej Los 4,866
3 Sergey Alexandrovich Kryukov 4,757
4 Kornfeld Eliyahu Peter 4,514


Advertise | Privacy | Mobile
Web01 | 2.8.141223.1 | Last Updated 12 Sep 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100