Share via


ISupportErrorInfo::InterfaceSupportsErrorInfo

A version of this page is also available for

Windows Embedded CE 6.0 R3

4/8/2010

This method indicates whether or not an interface supports the IErrorInfo interface.

Syntax

HRESULT InterfaceSupportsErrorInfo(
  REFIID riid
);

Parameters

  • riid
    [in] Pointer to an interface identifier (IID).

Return Value

If the interface supports IErrorInfo, the return value is S_OK.

If the interface does not support IErrorInfo, the return value is S_FALSE.

Remarks

Objects that support the IErrorInfo interface must also implement this interface.

Programs that receive an error return value should call IUnknown::QueryInterface to get a pointer to the ISupportErrorInfo interface, and then call InterfaceSupportsErrorInfo with the riid of the interface that returned the return value.

If InterfaceSupportsErrorInfo returns S_FALSE, then the error object does not represent an error returned from the caller, but from somewhere else. In this case, the error object can be considered incorrect and should be discarded.

If ISupportErrorInfo returns S_OK, use the GetErrorInfo function to get a pointer to the error object.

Example

The following code example implements the ISupportErrorInfo for the Lines sample. The IErrorInfo implementation also supports the AddRef, Release, and QueryInterface members inherited from the IUnknown interface.

CSupportErrorInfo::CSupportErrorInfo(IUnknown FAR* punkObject, REFIID riid)
{
   m_punkObject = punkObject;
   m_iid = riid;
}
STDMETHODIMP
CSupportErrorInfo::QueryInterface(REFIID iid, void FAR* FAR* ppv)
{
   return m_punkObject->QueryInterface(iid, ppv);
}
STDMETHODIMP_(ULONG)
CSupportErrorInfo::AddRef(void)
{
   return m_punkObject->AddRef();
}
STDMETHODIMP_(ULONG)
CSupportErrorInfo::Release(void)
{
   return m_punkObject->Release();
}
STDMETHODIMP
CSupportErrorInfo::InterfaceSupportsErrorInfo(REFIID riid)
{
   return (riid == m_iid) ? NOERROR : ResultFromScode(S_FALSE);
}

Requirements

Header oaidl.h, oaidl.idl
Library oleaut32.lib, uuid.lib
Windows Embedded CE Windows CE 2.0 and later
Windows Mobile Windows Mobile Version 5.0 and later

See Also

Reference

ISupportErrorInfo
IErrorInfo
GetErrorInfo
IUnknown::AddRef
IUnknown::QueryInterface
IUnknown::Release