Symptoms
In an MFC application, AfxThrowOleDispatchException is used to throw anexception from within an OLE Automation function. When Microsoft VisualBasic is used as the automation client application, it will not be able tocorrectly interpret the error code passed to AfxThrowOleDispatchException.
Resolution
AfxThrowOleDispatchException constructs and throws a COleDispatchExceptionobject, which is used to handle exceptions specific to the OLE IDispatchinterface. The constructor of COleDispatchException incorrectly initializesthe COleDispatchException object, resulting in the Visual Basic clientbeing unable to interpret the error code of the exception.