Exception handling in the Microsoft Foundation classes relies on “exception objects” and a group of macros. The process starts with the interruption of normal program execution in response to a THROW statement (macro invocation). Execution resumes at the appropriate CATCH statement leading into code that presumably deals with the abnormal condition. The exception objects, which are instances of classes derived from CException, differentiate the various kinds of exceptions and are used for communication.
This exception-handling scheme eliminates the need for extensive error testing after every library function call. If, for example, you enclose your entire program in an exception-handling block, then you don't have to test for low memory after each statement that contains the new operator.
If you don't provide exception-processing code in your classes, then exceptions will be caught in the Microsoft Foundation code. This results in termination of the program through the global function AfxTerminate, which normally calls the runtime function abort. You can use the AfxSetTerminate function to change the effect of AfxTerminate.