共用方式為


Returning Error Information

To return error information

  1. Implement the ISupportErrorInfointerface.

  2. To create an instance of the generic error object, call the CreateErrorInfo function.

  3. To set its contents, use the ICreateErrorInfomethods.

  4. To associate the error object with the current logical thread, call the SetErrorInfo function.

The following figure illustrates this procedure.

The error handling interfaces create and manage an error object, which provides information about the error. The error object is not the same as the object that encountered the error. It is a separate object associated with the current thread of execution.

Error Handling Interfaces