title: C# Is it possible to close that process?
body: <p>I have this code:</p>
  
  <pre><code>private void button1_Click(object sender, EventArgs e)
  {
      Process p = new Process();
      string path = AppDomain.CurrentDomain.BaseDirectory + "samp.exe";
      string arguments = "arguments...";
      p.Exited += new EventHandler(p_Exited);
      p.StartInfo.FileName = path;
      p.EnableRaisingEvents = true;
      p.Start();
  }
  </code></pre>
  
  <p>And</p>
  
  <pre><code>void p_Exited(object sender, EventArgs e)
  {
      MessageBox.Show("it works");
  }
  </code></pre>
  
  <p>It works, but when I launch <code>samp.exe</code>, the name changes to <code>gta_sa.exe</code>. I want to check if <code>gta_sa.exe</code> process was closed, then close my app.</p>
  
  <p><strong>SHORTLY:</strong> I want to make a button. When I click on, it launches <code>samp.exe</code> process, but <code>samp.exe</code> renames to <code>gta_sa.exe</code>, so I need to check if <code>gta_sa.exe</code> process was closed, close my app (Test.exe)</p>
  
  <p>My code is closing <code>samp.exe</code>, but I want to close <code>gta_sa.exe</code>.</p>