代码之家  ›  专栏  ›  技术社区  ›  Robert Davis

当子进程崩溃时,如何取消Microsoft错误报告对话框?

  •  9
  • Robert Davis  · 技术社区  · 15 年前

    我正在用 System.Diagnostics.Process 对象有时会严重崩溃,Windows会弹出“发送错误报告”对话框。我无法控制子进程,但我已经在处理它崩溃时的情况了,如何防止对话框弹出?

      Process p = new Process();
      p.StartInfo.FileName = Path.Combine(avokeHome, @"bin\folderstx.exe");
      p.StartInfo.Arguments = "-f" + propertiesFile;
      p.StartInfo.CreateNoWindow = true;
      p.StartInfo.UseShellExecute = false;
      p.StartInfo.RedirectStandardError = true;
      p.StartInfo.RedirectStandardOutput = true;
      p.OutputDataReceived += (sender, e) => { if(!string.IsNullOrEmpty(e.Data)) Console.WriteLine(e.Data); };
      p.ErrorDataReceived += (sender, e) => { if(!string.IsNullOrEmpty(e.Data)) Console.WriteLine(e.Data); };
      p.EnableRaisingEvents = true;
      p.Exited += (sender, e) => { Console.WriteLine("Exited"); };
      p.Start();
      p.BeginErrorReadLine();
      p.BeginOutputReadLine();
    
    1 回复  |  直到 15 年前
        1
  •  7
  •   Shoban    15 年前

    我认为实现这一点有点困难。报告错误是用户的选择(我们通过控制面板-操作中心-问题报告设置(Win 7)进行设置)

    也。退房 this article from MS Support 其中讨论了如何使用一些注册表项禁用此报告(对于所有应用程序)。

    推荐文章