I know the title is alittle confusing but I have a problem with getting a certain process that gets created by a process I start in my code and here is what I mean ..
private void BtnUNINSTALLG_Click(object sender, EventArgs e)
{
LoadingGif1.Visible = true;
Process p = Process.Start(@"C:\program files\XXXX\XXXX\XXX\XXXX.exe");
p.EnableRaisingEvents = true;
p.Exited += new EventHandler(UNINSTALL_Exited);
}
private void UNINSTALL_Exited(object sender, System.EventArgs e)
{
Invoke(new Action(() => {
LoadingGif1.Visible = false;
DoneGif1.Visible = true;
}));
}
What I do here is I start a process and after it exits I do some stuff .. but that doesn't work because this process create temp.exe ( changes name every time ) in temp folder and the process I started exits right after this temp process created.
I want to get the temp process created by the process I started and then wait until it exits instead of the process I started. Does anyone have any idea how can I do that ?