Errors are reported by returning a failure from a method. All methods return an HRESULT. To determine if a failure has occurred, call FAILED(hr). To get information about the error, call GetErrorInfo.
The following code fragment uses FAILED(hr) and GetErrorInfo:
if (FAILED(hr)) { IErrorInfo* pIErrorInfo; GetErrorInfo(0, &pIErrorInfo); BSTR desc; pIErrorInfo->GetDescription(&desc); // use the desc SysFreeString(desc); pIErrorInfo->Release(); }