I am trying to run explorer.exe using Process.start(ProcessInfo); function and then wait for the process to terminate itself and then perfom some action on the exit of the process. here is the code snippest
ProcessStartInfo StartInfo = new ProcessStartInfo();
StartInfo.FileName = "\\SDMMC\\explorer.exe";
StartInfo.UseShellExecute = false;
StartInfo.Arguments = null;
Process NewProcess = Process.Start(StartInfo);
NewProcess.WaitForExit();
NewProcess.EnableRaisingEvents = true;
NewProcess.Exited += new EventHandler(NewProcess_Exited);
MessageBox.Show("ExitCode finished");
but explorer.exe is still running and on the other hand NewProcess.HasExited is true, Please help how can I make the program wait for explorer.exe to terminate and then perfom any action. thanks