There are three interfaces and three functions that can be used in COM to provide error handling when programming in Java or Microsoft® Visual Basic®. In Java and Visual Basic, the method call does not return an HRESULT as the return value. Instead, these languages use the COM interfaces and functions to obtain HRESULTs and to handle errors or exceptions (exceptions are events beyond the program's control, such as file problems or invalid parameters).
The three interfaces that provide support for HRESULTs are listed and described briefly below:
ICreateErrorInfo | Sets error information. |
IErrorInfo | Returns information from an error object. |
ISupportErrorInfo | Identifies the object as supporting the IErrorInfo interface. |
The three functions that provide support for HRESULTs are listed and described briefly below:
CreateErrorInfo() | Creates an instance of a generic error object. |
GetErrorInfo() | Obtains the error information pointer set by the previous call to SetErrorInfo in the current logical thread. |
SetErrorInfo() | Sets the error information object for the current thread of execution. |
Initially, these error handling interfaces and functions applied exclusively to COM Automation objects. For this reason, they are documented under Automation in the COM and ActiveX Object Services branch of the Platform SDK.