How to disable dialog boxes with exceptions from Microsoft Visual C ++ Debug Library?

If I run an executable that throws an exception (built into debugging), I get an error dialog box saying something like "Debugging Error" and then some information about the exception. While this is happening, program execution is paused until I select Cancel, Retry, or Ignore.

The fact is that I run many applications from a script, and if one of them throws an exception, it pauses my script until it is processed.

Is there any way to disable this exception handling mechanism?

EDIT: I remember reading some time ago about a registry key that would disable the appearance of error messages. Does anyone know about this?

+7
windows exception-handling
source share
3 answers

If you can change the source of the application (s), look at the _CrtSetReportMode function, for example:

_CrtSetReportMode(_CRT_ASSERT, 0); 

See msdn for details .

+4
source share

If you can change the source, the interrupt behavior (called assert) must be changed to abort the abort / retry / ignore dialog.

In case of interruption, crashdump will be created by default (by default), so you won’t lose what is important.

In addition, you can configure assert behavior to write only to stderr. This is NOT required if the interrupt behavior is sufficient for what you want. Note: _Crtxxx calls are active only in debug builds (/ Zi).

Minimum change to disable the abort / retry / ignore function. Break the _Crt calls and enable crtdbg.h to also change the behavior of assert in the debug mode lines.

 #include <stdlib.h> //#include <crtdbg.h> int main(int argc,char **argv); int main(int argc,char **argv) { // ON assert, write to stderr. //_CrtSetReportMode( _CRT_ASSERT, _CRTDBG_MODE_FILE ); //_CrtSetReportFile( _CRT_ASSERT, _CRTDBG_FILE_STDERR ); // Suppress the abort message _set_abort_behavior( 0, _WRITE_ABORT_MSG); abort(); return 0; } 

msdn assert mode

+2
source share

Can you create your executables as a release? If I remember, this should stop the statement errors from appearing.

+1
source share

All Articles