本文整理汇总了C++中CComPtr::AddItem方法的典型用法代码示例。如果您正苦于以下问题:C++ CComPtr::AddItem方法的具体用法?C++ CComPtr::AddItem怎么用?C++ CComPtr::AddItem使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CComPtr
的用法示例。
在下文中一共展示了CComPtr::AddItem方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnAfterCommandExecute
STDMETHODIMP CManagedDebugSessionService::OnAfterCommandExecute(REFGUID guidCommandId, VARIANT* vParam, IVariantObject* pResult)
{
UNREFERENCED_PARAMETER(guidCommandId);
UNREFERENCED_PARAMETER(vParam);
UNREFERENCED_PARAMETER(pResult);
if (guidCommandId == DBGCOMMAND_OPENDUMP)
{
auto bLoaded = false;
{ //try to load dlls shipped with dump
if (vParam && vParam->vt == VT_BSTR)
{
CString strDumpPath = vParam->bstrVal;
StrPathRemoveFileName(strDumpPath);
CString strSosDllPath = strDumpPath;
StrPathAppend(strSosDllPath, L"sos.dll");
CString strMsCorDllPath = strDumpPath;
StrPathAppend(strMsCorDllPath, L"mscordacwks.dll");
if (PathFileExists(strMsCorDllPath) && PathFileExists(strSosDllPath))
{
CComPtr<IVariantObject> pv1;
RETURN_IF_FAILED(m_pDebugSessionService->ExecuteCommandSimple(DBGCOMMAND_LOADDLL, &CComVar(strMsCorDllPath), &pv1));
CComPtr<IVariantObject> pv2;
RETURN_IF_FAILED(m_pDebugSessionService->ExecuteCommandSimple(DBGCOMMAND_LOADDLL, &CComVar(strSosDllPath), &pv2));
bLoaded = true;
}
}
}
if (!bLoaded)
{
{ //analyze
RETURN_IF_FAILED(m_pDebugSessionService->ExecuteCommandSimple(DBGCOMMAND_ANALYZE, NULL, NULL));
}
{ //load sos
CComPtr<IPluginManager> pPluginManager;
RETURN_IF_FAILED(HrGetPluginManager(&pPluginManager));
CComPtr<IBstrCollection> pBstrCollection;
RETURN_IF_FAILED(pPluginManager->CoCreateInstance(CLSID_BstrCollection, IID_IBstrCollection, (LPVOID*)&pBstrCollection));
RETURN_IF_FAILED(pBstrCollection->AddItem(L"sos"));
RETURN_IF_FAILED(pBstrCollection->AddItem(L"clr"));
RETURN_IF_FAILED(m_pDebugSessionService->ExecuteCommandSimple(DBGCOMMAND_LOADBY, &CComVar(pBstrCollection), NULL));
}
}
{ //load sosex
RETURN_IF_FAILED(m_pDebugSessionService->LoadDll(L"sosex.dll"));
}
}
return S_OK;
}