How an Automation Component Returns an Error Object

OLE DB Programmer's Reference

When a component using Automation causes an error, it can return an object to describe that error. To do this, the component must do the following:

  1. Call CreateErrorInfo in the Automation DLL. This function creates an Automation error object that exposes ICreateErrorInfo and IErrorInfo.
  2. Call the methods in ICreateErrorInfo to store information in the error object, such as the string describing the error and the GUID of the interface that caused the error.
  3. Call QueryInterface to retrieve the IErrorInfo interface pointer on the error object. This interface pointer identifies the error object to all Automation components.
  4. Call SetErrorInfo in the Automation DLL and pass it the IErrorInfo interface pointer. This function replaces its current error object, if any, with the new error object and adds a reference count to the new error object.
  5. Call Release to release the ICreateErrorInfo and IErrorInfo interface pointers. This effectively transfers ownership of the error object from the component that caused the error to the Automation DLL.

1998-2001 Microsoft Corporation. All rights reserved.



Microsoft Ole Db 2.0 Programmer's Reference and Data Access SDK
Microsoft OLE DB 2.0 Programmers Reference and Data Access SDK (Microsoft Professional Editions)
ISBN: 0735605904
EAN: 2147483647
Year: 1998
Pages: 1083

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net