有沒有辦法確定我的程序啓動的進程崩潰了? 目前,我找到了解決辦法是看Process.ExitCode
和檢查值:在.NET中檢測進程崩潰
this.STProcess = Process.Start(this.CreateProcessStartInfo());
this.STProcess.WaitForExit();
if (STProcess.ExitCode != 0)
{
//raise error event...
}
我想知道是否有這樣做的更優雅而準確的方法是什麼?
我更喜歡C#中的答案,並且使用P/Invoke也不錯。
P.S - 我需要在Windows XP/Vista/7的
看到這些其他帖子:http://stackoverflow.com/questions/2279181/catch-another-process-unhandled-exception 和 http://stackoverflow.com/questions/673036/how-to-handle- a-crash-in-a-process-launch-via-system-diagnostics-process – jmservera 2010-02-22 09:41:24