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
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:
#include <windows.h>
//...
SetErrorMode(SetErrorMode(0) | SEM_NOGPFAULTERRORBOX);
//or if you only care about Vista or newer:
//SetErrorMode(GetErrorMode() | SEM_NOGPFAULTERRORBOX);
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...
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With