Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Display Dlg first, then do the stuff...

Status
Not open for further replies.

Mechy

Programmer
Sep 29, 2003
11
0
0
US
Hi,

I am relatively new to this VC++ thing and I am coding a simple FEA program. My problem is to display the dialog before the calculations are completed.

I use OnInitDialog() to jump to the functions that make the calculations but since the calculations take about 4-5 seconds, nothing is displayed until they are completed.

Where do I need to use the code to make the calculations right after the dialog is displayed?

Thanks.

Mechy.
 
Use SetTimer in OnInitdialog.
In OnTimer
use KillTimer to prevent rerunning of your code on OnTimer
do the calculations
use some SetDlgItemInt / SetDlgItemText to set dialog items in your dialog
 
ShowWindow(SW_SHOWNORMAL);

or

::ShowWindow(HWND, SW_SHOWNORMAL);


Trouble is, if you are displaying the dialog first, it will probably be locked and not painted properly if it takes 5 seconds todo calculations. You might need to think about creating a new thread inside of OnInitDialog instead. That way your GUI would remain usable.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top