Click to See Complete Forum and Search --> : Status Dialog Question?


Brad Cooper
August 13th, 1999, 10:50 AM
Hello All,
I currently trying to write a VC program to display a little box in the middle of the screen and display different status messages.

This is what I need.

1) Create, Display A window
2) After the window is visible, call a function.
3) That function needs to update the status field
4) Then another function is call
5) That function needs to update the status field
6) etc....
7) Then the program needs to exit without user intervention.

Any suggestions?

Thanks in advance,
Brad Cooper
coobr01@yahoo.com

Lane Galloway
August 13th, 1999, 01:46 PM
Brad,

Try creating a dialog resource with a text control. Write a member function of your dialog class to set the text of that control, say SetStatus(). Then:

void MyFunction()
{
CMyDialog dlg;
dlg.DoModal();
dlg.SetStatus("Entering foo1");
foo1();
dlg.SetStatus("Entering foo2");
foo2();
.
.
.
}



If you want to call SetStatus from within foo1 and foo2, you can pass a pointer to your dialog into those functions.

I hope that helps.

Lane

Wayne Fuller
August 13th, 1999, 02:00 PM
You need to create a Modeless Dialog box. Use the Create function to create it. Call whatever functions you want. Then when you are through with it call dlg.OnClose() to destroy it. Make sure you override PostNcDestroy and call "delete this" to freee the memory.

If you need any more details let me know.

Lane Galloway
August 13th, 1999, 04:14 PM
Sorry, but I omitted three components to my reply:

1. Hide any and all buttons in your dialog. Don't delete the OK button, just make it not visible.

2. Override CDialog::OnOK() and make it public. Have it call the base class function.

3. At the end of your function in which you create the dialog and call its DoModal function, call its OnOK function.

Lane Galloway
August 13th, 1999, 04:24 PM
I must be brain dead. Please ignore my posts and use a modeless dialog as Wayne Fuller suggested.

Sorry for any confusion I may have caused you.

Lane