次の方法で共有


ISupportErrorInfo::InterfaceSupportsErrorInfo (Windows CE 5.0)

Send Feedback

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

HRESULT InterfaceSupportsErrorInfo(REFIID riid);

Parameters

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

Return Values

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

OS Versions: Windows CE 2.0 and later.
Header: Oaidl.h, Oaidl.idl.
Link Library: Oleaut32.lib, Uuid.lib.

See Also

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

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.