Prevent windows from presenting any dialog on native code unhandled exception
Our buildserver compiles and runs testsuites for many different c++ programs. From time to time the programs are buggy, and can crash.
When they crash, Windows7 will always throw this modal dialog:
Which has to be clicked away by a human being, causing the buildserver to sit idle.
Is there a way to at a system level prevent this from happening? I kno开发者_JS百科w I can do it from within the process itself, but I'd love to be able to do it across the entire system.
Refer to "Disabling Dr.Watson in Windows 7" http://xheo.com/blog/disabling-dr-watson-in-windows-7
Calling WerAddExcludedApplication
should do the trick.
http://msdn.microsoft.com/en-us/library/bb513617.aspx
Or read more about Windows error reporting in MSDN:
http://msdn.microsoft.com/en-us/library/bb513636.aspx
You might try these lines at the start of your main.cpp
:
_CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_FILE);
_CrtSetReportFile(_CRT_ERROR, _CRTDBG_FILE_STDERR);
Read more about these APIs here: _CrtSetReportMode and _CrtSetReportFile.
Good luck!
Edit: Oops, not exactly what you were asking for. Oh well...
精彩评论