title: How to get the ExitCode of a running process
body: <p>I'm writing an application to check the exit code of another application. The application I am monitoring may already be running so I'm checking for it with Process.GetProcessesByName. If it exists I'm checking the exit code after a call to WaitForExit but when I do I get an exception:</p>
  
  <p>"Process was not started by this object, so requested information cannot be determined."</p>
  
  <p>If I start the process (if it isn't already running) then it doesn't give me the exception.</p>
  
  <p>(Windows 8.1)</p>
  
  <p>So how do I find out what the ExitCode was when I haven't started the process? The only option I can think of is to write an output code to a text file on exit and read that in...</p>