C++/CLI wait for process finish

Wami007 296 Reputation points
2021-02-09T10:53:17.003+00:00

Hello everbody, i need your help...!
I have to create GUI program with C++/CLI ( also known CLR) and in my program has multiple checkboxes for program selection and single button for install for selected Checkboxes. Also in background installers made from .batch based application for slient installation. So, i wrote code like this:
button click event ( if checkbox1 checked) {Process:Start ("path1")} // need wait this process until done then Continue to below ,
( if checkbox2 checked) {Process::Start ("path2") // need wait this too and etc...

 So now, when i click button all Process starts same time how can i do my desired result :( ?
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,238 questions
C++
C++
A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
3,527 questions
.NET Runtime
.NET Runtime
.NET: Microsoft Technologies based on the .NET software framework.Runtime: An environment required to run apps that aren't compiled to machine language.
1,119 questions
0 comments No comments
{count} votes

Accepted answer
  1. Castorix31 81,721 Reputation points
    2021-02-09T11:16:44.337+00:00

    If you want to wait for a process to be finished, you can do :

    System::Diagnostics::Process^ proc = gcnew System::Diagnostics::Process();
    proc->StartInfo->FileName = "notepad.exe";
    proc->Start();
    proc->WaitForExit();
    // After process end
    proc->Close();
    //...
    

0 additional answers

Sort by: Most helpful