c# - Detecting external process shut down from console application

Hi, 
I've got a console application written in C#.
I'm launching an external program from my application which is working fine but 
I'd like to be able to detect when the program I've started shuts down.
  This is the code I've got. i've put it in the main method of the app:
  Process UT2K4 = new Process();
UT2K4.StartInfo.FileName   = "c:\\ut2004\\system\\ut2004.exe";
UT2K4.StartInfo.Arguments = "-mod=AudioUT2K4";
UT2K4.Exited += new EventHandler( app.uT2K4Process_Exited);
UT2K4.Start();
  and this is the method for the exit handler:
  private void uT2K4Process_Exited(object sender, EventArgs e) {
Console.WriteLine ("ut2k4 shutdown");
Log.Write("user exited TTS server");
TTS.Speak("exiting", true);
}

       
---------------------------------
 Sent from Yahoo! - a smarter inbox.

Other related posts: