Detecting Process Completion : Process : Development C# Examples


C# Examples » Development » Process »

 

Detecting Process Completion









    
using  System;
using  System.Diagnostics;

class  MainClass
{
        static  void  ProcessDone(object  sender,  EventArgs  e)
        {
                Console.WriteLine("Process  Exited");
        }
        
        public  static  void  Main()
        {
                Process  p  =  new  Process();
                p.StartInfo.FileName  =  "notepad.exe";
                p.StartInfo.Arguments  =  "yourFile.cs";
                p.EnableRaisingEvents  =  true;
                p.Exited  +=  new  EventHandler(ProcessDone);
                p.Start();
                p.WaitForExit();
                Console.WriteLine("Back  from  WaitForExit()");
        }
}
    
   
  
   



Output

Process Exited
Back from WaitForExit()


HTML code for linking to this page:

Follow Navioo On Twitter

C# Examples

 Navioo Development
» Process