Home | Overview | How Do I | FAQ
The techniques and facilities for handling exceptions in OLE are the same as those for handling other exceptions. For further information on exception handling, see the article Exception Handling Topics.
All exception objects are derived from the abstract base class CException. MFC provides two classes for handling OLE exceptions:
The difference between these two classes is the amount of information they provide and where they are used. COleException has a public data member that contains the OLE status code for the exception. COleDispatchException supplies more information, including the following:
COleDispatchException provides more information so that it can be used with products like Microsoft Visual Basic. The verbal error description can be used in a message box or other notification; the Help information can be used to help the user respond to the conditions that caused the exception.
Two global functions correspond to the two OLE exception classes: AfxThrowOleException and AfxThrowOleDispatchException. Use them to throw general OLE exceptions and OLE dispatch exceptions, respectively.