title: How to close the windows opened by a process that has exited C#
body: <p>I need to check if a process is launched and then verify its exit code.</p>
  
  <pre><code> EXProcess.StartInfo.FileName = strExE;
   EXProcess.StartInfo.Arguments = tempFile;
   EXProcess.Start();
   do
  {}while (!rdcProcess.WaitForExit(1000));
  
  if (EXProcess.HasExited)
   { ...}
  
  EXProcess.Kill();
  </code></pre>
  
  <p>Now I have to close the windows that were opened by this process programmatically. In the sense I have to terminate everything that was started by this process.</p>
  
  <p>The process is launching an exe. I have to check if it was able to successfully launch it, so I need the exit code. Hence I'm waiting till the code exits. Now after I get the exit code, the window launched by the process stil exists. I have to clos that window/somehow kill the process. but EXProcess.Kill gives an exception - mentioned in the comment</p>
  
  <p>How do I do it?
  Please do help</p>