本文整理汇总了C++中IErrorInfo::GetHelpFile方法的典型用法代码示例。如果您正苦于以下问题:C++ IErrorInfo::GetHelpFile方法的具体用法?C++ IErrorInfo::GetHelpFile怎么用?C++ IErrorInfo::GetHelpFile使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IErrorInfo
的用法示例。
在下文中一共展示了IErrorInfo::GetHelpFile方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetExcepAndErrorInfo
// Info: Gets both unrestricted and restricted error info
// Parameters: scriptContext - the script context
// pexcepinfo - the exception info of the error (unrestricted)
// proerrstr - the winrt specific error strings (restricted)
// pperrinfo - the IErrorInfo object
// Returns: Failed HRESULT - if GetErrorInfo or QI fail
// Success - otherwise
HRESULT JavascriptErrorDebug::GetExcepAndErrorInfo(ScriptContext* scriptContext, HRESULT hrReturned, EXCEPINFO *pexcepinfo, RestrictedErrorStrings * proerrstr, IErrorInfo ** pperrinfo)
{
HRESULT hr;
HRESULT hrResult;
bool errorInfoMatch = false;
memset(pexcepinfo, 0, sizeof(*pexcepinfo));
memset(proerrstr, 0, sizeof(*proerrstr));
*pperrinfo = nullptr;
// GetErrorInfo returns S_FALSE if there is no rich error info
// and S_OK if there is.
IErrorInfo * perrinfo;
if(NOERROR != (hr = GetErrorInfo(0L, &perrinfo)))
{
return hr;
}
// Fill Exception info
perrinfo->GetSource(&pexcepinfo->bstrSource);
perrinfo->GetDescription(&pexcepinfo->bstrDescription);
perrinfo->GetHelpFile(&pexcepinfo->bstrHelpFile);
perrinfo->GetHelpContext(&pexcepinfo->dwHelpContext);
// Initialize restricted strings
proerrstr->restrictedErrStr = nullptr;
proerrstr->referenceStr = nullptr;
proerrstr->capabilitySid = nullptr;
BSTR bstrErr = nullptr;
BSTR bstrRestrictedErr = nullptr;
BSTR bstrCapabilitySid = nullptr;
BSTR bstrReference = nullptr;
IRestrictedErrorInfo * pROErrorInfo = nullptr;
_Exception * pCLRException = nullptr;
hr = perrinfo->QueryInterface(__uuidof(IRestrictedErrorInfo), reinterpret_cast<void**>(&pROErrorInfo));
if (SUCCEEDED(hr))
{
// Get restricted error strings from IRestrictedErrorInfo
HRESULT hrErr = S_OK;
hrResult = pROErrorInfo->GetErrorDetails(&bstrErr, &hrErr, &bstrRestrictedErr, &bstrCapabilitySid);
if (SUCCEEDED(hrResult))
{
errorInfoMatch = (hrErr == hrReturned);
if (errorInfoMatch)
{
if (nullptr != bstrRestrictedErr)
{
proerrstr->restrictedErrStr = bstrRestrictedErr;
bstrRestrictedErr = nullptr;
}
if (nullptr != bstrCapabilitySid)
{
proerrstr->capabilitySid = bstrCapabilitySid;
bstrCapabilitySid = nullptr;
}
}
}
hrResult = pROErrorInfo->GetReference(&bstrReference);
if (SUCCEEDED(hrResult) && errorInfoMatch)
{
if (nullptr != bstrReference)
{
proerrstr->referenceStr = bstrReference;
bstrReference = nullptr;
}
}
}
else
{
hr = perrinfo->QueryInterface(__uuidof(_Exception), reinterpret_cast<void**>(&pCLRException));
if(FAILED(hr))
{
perrinfo->Release();
return hr;
}
hrResult = pCLRException->get_Message(&bstrRestrictedErr);
if (SUCCEEDED(hrResult))
{
errorInfoMatch = true;
if (nullptr != bstrRestrictedErr)
{
proerrstr->restrictedErrStr = bstrRestrictedErr;
bstrRestrictedErr = nullptr;
}
}
}
if (nullptr != bstrErr)
{
SysFreeString(bstrErr);
bstrErr = nullptr;
}
if (nullptr != bstrRestrictedErr)
//.........这里部分代码省略.........