I am spawning new processes in my C# application with System.Diagnostics.Process like this:
void SpawnNewProcess
{
string fileName = GetFileName();
System.Diagnostics.Process proc = new System.Diagnostics.Process();
proc.StartInfo.FileName = fileName;
proc.Start();
proc.Exited += new EventHandler(ProcessExited);
proc.EnableRaisingEvents = true;
}
private void ProcessExited(Object source, EventArgs e)
{
}
The user is free to spawn as many processes as he likes - now the question: I'm in the ProcessExited function, how do I find out which of the processes has quit ?
The example in the MSDN just shows how to use a member variable for this - but this wouldn't work with more processes.
Any ideas how I find out which process just exited ?