Process.Exited : Process « System.Diagnostics « C# / C Sharp by API






Process.Exited

 


using System;
using System.Diagnostics;

public class DetectingProcessCompletion
{
    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 = "process3.cs";
        p.EnableRaisingEvents = true;
        p.Exited += new EventHandler(ProcessDone);
        p.Start();
        p.WaitForExit();
        Console.WriteLine("Back from WaitForExit()");
    }
}

   
  








Related examples in the same category

1.Process.CloseMainWindow
2.Process.GetCurrentProcess()
3.Process.GetProcessById
4.Process.Kill()
5.Process.Modules
6.Process.PeakWorkingSet64
7.Process.PriorityClass
8.Process.PrivateMemorySize
9.Process.ProcessName
10.Process.StandardOutput.ReadToEnd()
11.Process.Start
12.Process.StartInfo.RedirectStandardOutput
13.Process.Threads
14.Process.TotalProcessorTime
15.Process.VirtualMemorySize
16.Process.WaitForExit
17.Process.WorkingSet