How an Automation Consumer Retrieves an Error Object

OLE DB Programmer's Reference

When an Automation consumer retrieves an error object in response to a return code it received, the consumer performs the following actions:

  1. If it does not already have an ISupportErrorInfo interface pointer on the component, the consumer can request one by calling QueryInterface on the component. ISupportErrorInfo must be supported by all components that create error objects.
  2. If it has not already determined whether the interface that returned the code supports error objects, the consumer calls ISupportErrorInfo::InterfaceSupportsErrorInfo and passes it the IID of the interface containing the method that returned the code. ISupportErrorInfo::InterfaceSupportsErrorInfo returns S_OK if the interface supports error objects (meaning the consumer should retrieve the current error object, if one exists) and returns S_FALSE if the interface does not support error objects (meaning the consumer should not retrieve the current error object because it applies to another interface and method).
  3. Call GetErrorInfo in the Automation DLL. This function returns an IErrorInfo interface pointer on the current error object and releases its reference count on the error object, transferring ownership of the error object to the consumer.
  4. Call the methods in the IErrorInfo interface to retrieve information from the error object. For example, IErrorInfo::GetDescription can be called to retrieve a text description of the error.
  5. Call Release on the error object to release it.

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