locked
How to display a dialog at program executing time and close it at program end? RRS feed

  • Question

  • I am a learner of vc 2005. I want to show a dialog while program running and at the end of program close the dialog. Can anyone help me? Thanks a lots.

    private: System::Void PDU_Outlet_Shown(System::Object^  sender, System::EventArgs^  e) {
        String^ vInstInfo;

        ShowDialog; <--------------------------------------------------- some instruction to show the dialog and let the user know the program is running

        if (Get_PDGP_Data(gPDUID, &vInstInfo)) // get PDU name
        {
         tbPDULocation->Text = vInstInfo;
        }
        else
        {
         tbPDULocation->Text = ""; // fill empty
        }

    .......

         CloseDialog; ---------------------------------------->when the program is running over than close the dialog.

    }

    Wednesday, April 13, 2011 10:25 AM

Answers

  • D.Sreedhar's reply is for pure WinAPI.

    Create new form. On startup display it: your_form -> Show(); and on close for example your_form -> Hide();


    Nikita Leontiev
    • Marked as answer by Peter_Yu Thursday, April 28, 2011 5:39 AM
    Wednesday, April 27, 2011 10:17 AM

All replies

  • BOOL WINAPI ShowWindow(
    
     __in  HWND hWnd,
    
     __in  int nCmdShow
    
    );
    --------
    BOOL WINAPI CloseWindow(
    
     __in  HWND hWnd
    
    );
    
    
    --------------
    BOOL WINAPI DestroyWindow(
    
     __in  HWND hWnd
    
    );
    
    

    Knowledge is like light; It spreads only when you have clear and transparent mind.
    Wednesday, April 13, 2011 12:31 PM
  • Hi Energybody,

    Does the D.Sreedhar's reply solve this issue?

    Generally speaking, we need to create a window using CreateWindow() function, then show this window.

    I would recommend that you have a look at the following link which is a tutorial about win32 programming:

    http://www.winprog.org/tutorial/start.html

    When you are done with this tutorial, I think you will know how to resolve this issue.

     

    Best regards,

    Peter

     


    Pet Yu [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Monday, April 18, 2011 7:52 AM
  • what is it mean  __in? will that has a easy way to use c++ 2005?

    Tuesday, April 19, 2011 1:53 AM
  • _in only mean that the parameter is the input type parameter on the contrary with _out.

    I suggest that you have a look at the following official website link which tells you how to use visual studio 2005 step by step:

    http://msdn.microsoft.com/en-us/library/ms235630(VS.80).aspx

    It’s not as difficult as you think.

    Best regards,

    Peter


    Pet Yu [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Tuesday, April 19, 2011 2:19 AM
  • But the ShorWindos can't show a string of telling people the program is running and wait. Is there another solution for this?
    Wednesday, April 27, 2011 9:50 AM
  • D.Sreedhar's reply is for pure WinAPI.

    Create new form. On startup display it: your_form -> Show(); and on close for example your_form -> Hide();


    Nikita Leontiev
    • Marked as answer by Peter_Yu Thursday, April 28, 2011 5:39 AM
    Wednesday, April 27, 2011 10:17 AM