When you have a catch all block, written as catch (...) in your code, asynchronous exceptions might or might not get caught, depending on
- whether you are compiling in debug mode or release mode
- whether you are using Visual Studio 2005 or an earlier version
If you want to go into the details of what has been explained above, this could be a very good article.
Coming back to the original topic, when you have an unhandled exception, i.e. something for which there is no appropriate catch block, several things happen in the background. You can read this MSJ article for details. In short, your application crashes (but doesn't terminate!), and you get a popup at the end similar to the one shown below. Once you press OK on this popup, the process terminates completely.
You can disable the release mode pop-up using
SetErrorMode (SEM_NOGPFAULTERRORBOX);
However, if you are building in debug mode, the pop-up box would be completely different; offering debug services!
The reason you see this "application has requested the runtime to terminate it" is because of the settings debugger does. You can disable them by using _CrtSetReportMode and _CrtSetReportFile methods. You'll have to include crtdbg.h in your code.
Below is one example:
_CrtSetReportMode( _CRT_ERROR, _CRTDBG_MODE_FILE);
_CrtSetReportFile( _CRT_ERROR, _CRTDBG_FILE_STDERR );
No comments:
Post a Comment