Is there a way to determine that a process that my program started has crashed?
Currently, the solution I found is to look at Process.ExitCode
and examine the value:
this.STProcess = Process.Start(this.CreateProcessStartInfo());
this.STProcess.WaitForExit();
if (STProcess.ExitCode != 0)
{
//raise error event...
}
I wanted to know if there is a more elegant (and accurate) way of doing this?
I would prefer answers in C# and using P/Invoke is fine as well.
P.S - I need to work on windows XP/Vista/7
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…