I am trying to get the exit code of an application (IE) after the process
closes. On my system I keep getting an exception error. "No process is
associated with the object." The Process class is suppose to keep some
administrative information available on a closed process (i.e., the ExitCode,
HasExited, etc.) but it seems to not do this. Does anyone know how to get
around this problem?
The code is a simple C# form with a button. The button's click code is below.
private void button1_Click(o bject sender, EventArgs e)
{
Process spawned = Process.Start(" iexplore.exe");
Thread.Sleep(20 00);
if (spawned.Respon ding)
{
Thread.Sleep(10 000);
spawned.CloseMa inWindow();
spawned.Close() ;
spawned.Refresh ();
int exitCode = spawned.ExitCod e;
}
}
--
-----------
Thanks,
Steve