Click here to Skip to main content
12,953,230 members (65,336 online)
Rate this:
Please Sign up or sign in to vote.
See more:
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 0:31am
Rate this: bad
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.
Rate this: bad
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.

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

    Print Answers RSS
Top Experts
Last 24hrsThis month
OriginalGriff 6,429
CHill60 3,490
Maciej Los 3,103
Jochen Arndt 1,975
ppolymorphe 1,920

Advertise | Privacy | Mobile
Web02 | 2.8.170525.1 | Last Updated 12 Sep 2012
Copyright © CodeProject, 1999-2017
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