Important: |
---|
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist. |
When you implement IDispatch::Invoke, errors can be communicated either through the normal return value or by raising an exception. An exception is a special situation that is normally handled by jumping to the nearest routine enclosing the exception handler.
To raise an exception, Invokereturns DISP_E_EXCEPTION and fills the structure passed through pExcepInfowith information about the cause of the exception or error. You can use the information to understand the cause of the exception and proceed as necessary.
The exception information structure includes an error code number that identifies the kind of exception (a string that describes the error in a human-readable way). It also includes a Help file and a Help context number that can be passed to Windows Help for details about the error.
At a minimum, the error code number must be filled with a valid number.
If you consider IDispatchanother way to call C++ methods in an interface, EXCEPINFO models the raising of an exception or longjmpcall by such a method.