防止 Windows 中的崩溃消息
我的应用程序需要扫描经常导致崩溃的第三方文件。 为了克服这个问题,它使用一个单独的进程来扫描这些文件并 每当这个进程崩溃时,我的应用程序就会实例化另一个应用程序。
我的问题是,每次崩溃后我都会收到 Windows 崩溃消息: “AuxScanner 已停止工作...”
如何防止出现此消息并安静地崩溃?
我使用命名管道进行进程间通信。
谢谢
My application needs to scan 3rd party files that often leads to crash.
In order to overcome that, it uses a separate process to scan those files and
whenever this process crashes my application just instantiates another one.
My problem is that after each crash I get Windows crash message:
"AuxScanner has stopped working..."
How can I prevent this message and crash quietly?
I'm using named pipes for inter-process communication.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
处理 .NET (CLR) 异常。
处理 C++ 异常。
处理您的SEH 异常。
请参阅 http: //blogs.msdn.com/b/kirush/archive/2008/04/24/global-crash-handler-for-c-application.aspx
最后的手段:
设置错误模式(SEM_NOGPFAULTERRORBOX)
Handle your .NET (CLR) exceptions.
Handle your C++ exceptions.
Handle your SEH exceptions.
See http://blogs.msdn.com/b/kirush/archive/2008/04/24/global-crash-handler-for-c-application.aspx
Last resort:
SetErrorMode(SEM_NOGPFAULTERRORBOX)
请参阅 http://blogs.msdn.com/b/oldnewthing/archive/2004 /07/27/198410.aspx:您可以禁用程序崩溃对话框(尽管您需要从子进程内部执行此操作)。
按照我的理解,您希望在子流程中出现类似这样的内容:
顺便说一下,有趣的问题 - 在开发过程中坚持使用各种软件可能会很有趣;当你积极开发的代码崩溃(并不意外),然后一切都在等待,你的 UI 改变焦点,并且它提供(毫无意义地)向微软发送故障转储时,这是非常烦人的......
See http://blogs.msdn.com/b/oldnewthing/archive/2004/07/27/198410.aspx: you can disable the program crash dialog (though you'll need to do so from inside the sub-process).
The way I read it, you want something like this in your sub-process:
Interesting question by the way - this might be interesting to stick into all kinds of software during development; it's quite annoying when your actively-developed code crashes (not unexpected), and then then everything waits, your UI changes focus, and it offers to (pointlessly) send a crash dump to microsoft...
如果您收到“...已停止工作”消息,则意味着您没有处理异常。确保可能或可能导致崩溃的代码部分包含在 try/catch 块中,并妥善处理异常。
If you're getting the "...hast stopped working" message that means you didn't handle the exception. Make sure the sections of code that can or might be inducing the crash are wrapped in try/catch blocks and handle the exceptions gracefully.