CComCoClass::Error

static HRESULT Error( LPCOLESTR lpszDesc, const IID& iid = GUID_NULL, HRESULT hRes = 0 );

static HRESULT Error( LPCOLESTR lpszDesc, DWORD dwHelpID, LPCOLESTR lpszHelpFile, const IID& iid = GUID_NULL, HRESULT hRes = 0 );

static HRESULT Error( LPCSTR lpszDesc, const IID& iid = GUID_NULL, HRESULT hRes = 0 );

static HRESULT Error( LPCSTR lpszDesc, DWORD dwHelpID, LPCSTR lpszHelpFile, const IID& iid = GUID_NULL, HRESULT hRes = 0 );

static HRESULT Error( UINT nID, const IID& iid = GUID_NULL, HRESULT hRes = 0, HINSTANCE hInst = _Module.GetResourceInstance( ) );

static HRESULT Error( UINT nID, DWORD dwHelpID, LPCOLESTR lpszHelpFile, const IID& iid = GUID_NULL, HRESULT hRes = 0, HINSTANCE hInst = _Module.GetResourceInstance( ) );

Return Value

A standard HRESULT value. For details, see Remarks.

Parameters

lpszDesc

[in] The string describing the error. The Unicode version of Error specifies that lpszDesc is of type LPCOLESTR; the ANSI version specifies a type of LPCSTR.

iid

[in] The IID of the interface defining the error or GUID_NULL (the default value) if the error is defined by the operating system.

hRes

[in] The HRESULT you want returned to the caller. The default value is 0. For more details about hRes, see Remarks.

nID

[in] The resource identifier where the error description string is stored. This value should lie between 0x0200 and 0xFFFF, inclusively. In debug builds, an ASSERT will result if nID does not index a valid string. In release builds, the error description string will be set to “Unknown Error.”

dwHelpID

[in] The help context identifier for the error.

lpszHelpFile

[in] The path and name of the help file describing the error.

hInst

[in] The handle to the resource. By default, this parameter is _Module::GetResourceInstance, where _Module is the global instance of CComModule or a class derived from it.

Remarks

This static method sets up the IErrorInfo interface to provide error information to the client. In order to call Error, your object must implement the ISupportErrorInfo interface.

If the hRes parameter is nonzero, then Error returns the value of hRes. If hRes is zero, then the first four versions of Error return DISP_E_EXCEPTION. The last two versions return the result of the macro MAKE_HRESULT( 1, FACILITY_ITF, nID ).

CComCoClass OverviewClass Members

See Also   ISupportErrorInfoImpl, MAKE_HRESULT