CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Aug 1999
    Posts
    1

    Status Dialog Question?

    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
    [email protected]


  2. #2
    Join Date
    Apr 1999
    Location
    Seattle, WA
    Posts
    74

    Re: Status Dialog Question?

    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



  3. #3
    Join Date
    May 1999
    Location
    Texas, USA
    Posts
    568

    Re: Status Dialog Question?

    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.


  4. #4
    Join Date
    Apr 1999
    Location
    Seattle, WA
    Posts
    74

    Re: Status Dialog Question?

    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.


  5. #5
    Join Date
    Apr 1999
    Location
    Seattle, WA
    Posts
    74

    Re: Status Dialog Question?

    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


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured