ISupportErrorInfo::InterfaceSupportsErrorInfo

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

At a Glance

Header file: Oaidl.h
Windows CE versions: 2.0 and later

Syntax

HRESULT InterfaceSupportsErrorInfo(REFIID riid);

Parameters

riid

Pointer to an interface identifier (IID).

Return Values

One of the values described in the following table is returned.

Value Description
S_OK Interface supports IErrorInfo.
S_FALSE Interface does not support IErrorInfo.

Remarks

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

Programs that receive an error return value should call 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);
}