• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ atl::CComPtr类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中atl::CComPtr的典型用法代码示例。如果您正苦于以下问题:C++ CComPtr类的具体用法?C++ CComPtr怎么用?C++ CComPtr使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了CComPtr类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: GetHtmlElementAttribute

GetHtmlElementAttributeResult GetHtmlElementAttribute(IHTMLElement& htmlElement,
  const ATL::CComBSTR& attributeName)
{
  GetHtmlElementAttributeResult retValue;
  ATL::CComVariant vAttr;
  ATL::CComPtr<IHTMLElement4> htmlElement4;
  if (FAILED(htmlElement.QueryInterface(&htmlElement4)) || !htmlElement4)
  {
    return retValue;
  }
  ATL::CComPtr<IHTMLDOMAttribute> attributeNode;
  if (FAILED(htmlElement4->getAttributeNode(attributeName, &attributeNode)) || !attributeNode)
  {
    return retValue;
  }
  // we set that attribute found but it's not necessary that we can retrieve its value
  retValue.isAttributeFound = true;
  if (FAILED(attributeNode->get_nodeValue(&vAttr)))
  {
    return retValue;
  }
  if (vAttr.vt == VT_BSTR && vAttr.bstrVal)
  {
    retValue.attributeValue = vAttr.bstrVal;
  }
  else if (vAttr.vt == VT_I4)
  {
    retValue.attributeValue = std::to_wstring(vAttr.iVal);
  }
  return retValue;
}
开发者ID:junaidnaseer,项目名称:adblockplusie,代码行数:31,代码来源:MsHTMLUtils.cpp


示例2: IsFlashRequest

// This is the heuristic which detects the requests issued by Flash.ocx.
// It turned out that the implementation from ''Flash.ocx'' (tested version is 15.0.0.152)
// returns quite minimal configuration in comparison with the implementation from Microsofts'
// libraries (see grfBINDF and bindInfo.dwOptions). The impl from MS often includes something
// else.
bool WBPassthruSink::IsFlashRequest(const wchar_t* const* additionalHeaders)
{
  if (additionalHeaders && *additionalHeaders)
  {
    auto flashVersionHeader = ExtractHttpHeader<std::wstring>(*additionalHeaders, L"x-flash-version:", L"\n");
    if (!TrimString(flashVersionHeader).empty())
    {
      return true;
    }
  }
  ATL::CComPtr<IBindStatusCallback> bscb;
  if (SUCCEEDED(QueryServiceFromClient(&bscb)) && !!bscb)
  {
    DWORD grfBINDF = 0;
    BINDINFO bindInfo = {};
    bindInfo.cbSize = sizeof(bindInfo);
    if (SUCCEEDED(bscb->GetBindInfo(&grfBINDF, &bindInfo)) &&
      (BINDF_ASYNCHRONOUS | BINDF_ASYNCSTORAGE| BINDF_PULLDATA) == grfBINDF &&
      (BINDINFO_OPTIONS_ENABLE_UTF8 | BINDINFO_OPTIONS_USE_IE_ENCODING) == bindInfo.dwOptions
      )
    {
      return true;
    }
  }
  return false;
}
开发者ID:junaidnaseer,项目名称:adblockplusie,代码行数:31,代码来源:PluginWbPassThrough.cpp


示例3: ReplaceMethodWith

	HRESULT InjectedType::ReplaceMethodWith(const ModuleID moduleId, const mdToken functionToken, InstructionList &instructions, const mdSignature localVarSigTok, const unsigned minimumStackSize, ExceptionHandlerList &exceptions) const
	{
		IMAGE_COR_ILMETHOD* pMethodHeader = nullptr;
		ULONG iMethodSize = 0;
		GUARD_FAILURE_HRESULT(m_profilerInfo->GetILFunctionBody(moduleId, functionToken, (LPCBYTE*)&pMethodHeader, &iMethodSize));

		Method method(pMethodHeader);
		method.DeleteAllInstructions();
		method.AppendInstructions(instructions);
		method.SetMinimumStackSize(minimumStackSize);

		if (exceptions.size() > 0)
		{
			method.AddExceptionHandlers(exceptions);
		}

		ATL::CComPtr<IMethodMalloc> methodMalloc;
		GUARD_FAILURE_HRESULT(m_profilerInfo->GetILFunctionBodyAllocator(moduleId, &methodMalloc));

		IMAGE_COR_ILMETHOD* pNewMethod = static_cast<IMAGE_COR_ILMETHOD*>(methodMalloc->Alloc(method.GetMethodSize()));
		method.WriteMethod(pNewMethod);

		if (localVarSigTok != mdSignatureNil)
		{
			pNewMethod->Fat.Flags |= CorILMethod_InitLocals; // always added when local variables present: http://www.liranchen.com/2010/07/behind-locals-init-flag.html
			pNewMethod->Fat.LocalVarSigTok = localVarSigTok;
		}

		GUARD_FAILURE_HRESULT(m_profilerInfo->SetILFunctionBody(moduleId, functionToken, (LPCBYTE)pNewMethod));

		return S_OK;
	}
开发者ID:secdec,项目名称:codepulse,代码行数:32,代码来源:InjectedType.cpp


示例4: DefineAssemblyMaxVersionRef

	HRESULT InjectedType::DefineAssemblyMaxVersionRef(const ModuleID moduleId, LPCWSTR assemblyName, mdModuleRef* moduleRef) const
	{
		ATL::CComPtr<IMetaDataAssemblyEmit> metaDataAssemblyEmit;
		GUARD_FAILURE_HRESULT(GetMetaDataAssemblyEmit(moduleId, metaDataAssemblyEmit));

		AssemblyReference mscorlibReference;
		if (!m_assemblyRegistry->FindMaxAssemblyVersion(assemblyName, mscorlibReference))
		{
			return E_FAIL;
		}

		ASSEMBLYMETADATA mscorlibMetadata;
		ZeroMemory(&mscorlibMetadata, sizeof(mscorlibMetadata));
		mscorlibMetadata.usMajorVersion = mscorlibReference.version.majorVersion;
		mscorlibMetadata.usMinorVersion = mscorlibReference.version.minorVersion;
		mscorlibMetadata.usBuildNumber = mscorlibReference.version.buildNumber;
		mscorlibMetadata.usRevisionNumber = mscorlibReference.version.revisionNumber;

		const auto name = mscorlibReference.name.c_str();
		return metaDataAssemblyEmit->DefineAssemblyRef(mscorlibReference.publicKeyToken,
			sizeof(mscorlibReference.publicKeyToken),
			name,
			&mscorlibMetadata,
			nullptr,
			0,
			0,
			moduleRef);
	}
开发者ID:secdec,项目名称:codepulse,代码行数:28,代码来源:InjectedType.cpp


示例5: ShowModeless

HRESULT CSysProgressDlg::ShowModeless(HWND hWndParent, BOOL immediately)
{
    EnsureValid();
    m_hWndProgDlg = NULL;
    if (!IsValid())
        return E_FAIL;
    m_hWndParent = hWndParent;
    HRESULT hr = m_pIDlg->StartProgressDialog(hWndParent, NULL, m_dwDlgFlags, NULL);
    if(FAILED(hr))
        return hr;

    ATL::CComPtr<IOleWindow> pOleWindow;
    HRESULT hr2 = m_pIDlg.QueryInterface(&pOleWindow);
    if(SUCCEEDED(hr2))
    {
        hr2 = pOleWindow->GetWindow(&m_hWndProgDlg);
        if(SUCCEEDED(hr2))
        {
            // see comment in ShowModal() for why we subclass the window
            if (!m_isVisible)
            {
                m_OrigProc = (WNDPROC) SetWindowLongPtr(m_hWndProgDlg, GWLP_WNDPROC, (LONG_PTR) fnSubclass);
                SetProp(m_hWndProgDlg, L"ParentWindow", m_hWndParent);
                SetProp(m_hWndProgDlg, L"OrigProc", m_OrigProc);
            }
            if (immediately)
                ShowWindow(m_hWndProgDlg, SW_SHOW);
        }
    }
    m_isVisible = true;
    return hr;
}
开发者ID:,项目名称:,代码行数:32,代码来源:


示例6: ShowModeless

HRESULT CSysProgressDlg::ShowModeless(HWND hWndParent, BOOL immediately)
{
	EnsureValid();
	m_hWndProgDlg = nullptr;
	if (!IsValid())
		return E_FAIL;
	m_hWndParent = hWndParent;
	auto winId = GetWindowThreadProcessId(m_hWndParent, 0);
	auto threadId = GetCurrentThreadId();
	if (winId != threadId)
		AttachThreadInput(winId, threadId, TRUE);
	m_hWndFocus = GetFocus();
	if (winId != threadId)
		AttachThreadInput(winId, threadId, FALSE);
	HRESULT hr = m_pIDlg->StartProgressDialog(hWndParent, nullptr, m_dwDlgFlags, nullptr);
	if(FAILED(hr))
		return hr;

	ATL::CComPtr<IOleWindow> pOleWindow;
	HRESULT hr2 = m_pIDlg.QueryInterface(&pOleWindow);
	if(SUCCEEDED(hr2))
	{
		hr2 = pOleWindow->GetWindow(&m_hWndProgDlg);
		if(SUCCEEDED(hr2))
		{
			if (immediately)
				ShowWindow(m_hWndProgDlg, SW_SHOW);
		}
	}
	m_isVisible = true;
	return hr;
}
开发者ID:tribis,项目名称:TortoiseGit,代码行数:32,代码来源:SysProgressDlg.cpp


示例7: DeleteJumpList

void DeleteJumpList(LPCTSTR appID)
{
	ATL::CComPtr<ICustomDestinationList> pcdl;
	HRESULT hr = pcdl.CoCreateInstance(CLSID_DestinationList, nullptr, CLSCTX_INPROC_SERVER);
	if (SUCCEEDED(hr)) {
		pcdl->DeleteList(appID);
	}
}
开发者ID:AJH16,项目名称:TortoiseGit,代码行数:8,代码来源:JumpListHelpers.cpp


示例8: ClearProvider

void ListViewAccServer::ClearProvider( HWND hControl )
{
    ATL::CComPtr<IAccPropServices> pAccPropSvc;
    HRESULT hr = pAccPropSvc.CoCreateInstance(CLSID_AccPropServices, NULL, CLSCTX_SERVER);
    if (hr == S_OK && pAccPropSvc)
    {
        MSAAPROPID propid = PROPID_ACC_HELP;
        pAccPropSvc->ClearHwndProps(hControl, (DWORD)OBJID_CLIENT, CHILDID_SELF, &propid, 1);
    }
}
开发者ID:TortoiseGit,项目名称:tortoisesvn,代码行数:10,代码来源:ListViewAccServer.cpp


示例9: GetRVAFromKnownDefaultCtor

	HRESULT InjectedType::GetRVAFromKnownDefaultCtor(ATL::CComPtr<IMetaDataImport>& metaDataImport,
		const LPCWSTR knownTypeDefName,
		mdTypeDef* pKnownTypeDef,
		mdMethodDef* pKnownTypeDefaultCtorDef,
		ULONG* pCodeRVA)
	{
		GUARD_FAILURE_HRESULT(metaDataImport->FindTypeDefByName(knownTypeDefName, mdTokenNil, pKnownTypeDef));
		GUARD_FAILURE_HRESULT(metaDataImport->FindMethod(*pKnownTypeDef, L".ctor", ctorSignature, sizeof(ctorSignature), pKnownTypeDefaultCtorDef));
		GUARD_FAILURE_HRESULT(metaDataImport->GetMethodProps(*pKnownTypeDefaultCtorDef, nullptr, nullptr, 0, nullptr, nullptr, nullptr, nullptr, pCodeRVA, nullptr));

		return S_OK;
	}
开发者ID:secdec,项目名称:codepulse,代码行数:12,代码来源:InjectedType.cpp


示例10: SetAccProperty

bool CCommonAppUtils::SetAccProperty(HWND hWnd, MSAAPROPID propid, const CString& text)
{
    ATL::CComPtr<IAccPropServices> pAccPropSvc;
    HRESULT hr = pAccPropSvc.CoCreateInstance(CLSID_AccPropServices, NULL, CLSCTX_SERVER);

    if (hr == S_OK && pAccPropSvc)
    {
        pAccPropSvc->SetHwndPropStr(hWnd, (DWORD)OBJID_CLIENT, CHILDID_SELF, propid, text);
        return true;
    }
    return false;
}
开发者ID:ch3cooli,项目名称:TSVNUtils,代码行数:12,代码来源:CommonAppUtils.cpp


示例11: HasTypeDef

	bool InjectedType::HasTypeDef(const ModuleID moduleId, const LPCWSTR typeDefName) const
	{
		ATL::CComPtr<IMetaDataImport> metaDataImport;
		auto result = GetMetaDataImport(moduleId, metaDataImport);
		if (result != S_OK)
		{
			return false;
		}

		mdTypeDef systemObject = mdTokenNil;
		result = metaDataImport->FindTypeDefByName(typeDefName, mdTokenNil, &systemObject);
		return result == S_OK;
	}
开发者ID:secdec,项目名称:codepulse,代码行数:13,代码来源:InjectedType.cpp


示例12: ShowModal

HRESULT CSysProgressDlg::ShowModal(HWND hWndParent, BOOL immediately /* = true */)
{
    EnsureValid();
    m_hWndProgDlg = NULL;
    if (!IsValid())
        return E_FAIL;
    m_hWndParent = hWndParent;
    HRESULT hr = m_pIDlg->StartProgressDialog(hWndParent, NULL, m_dwDlgFlags | PROGDLG_MODAL, NULL);
    if(FAILED(hr))
        return hr;

    ATL::CComPtr<IOleWindow> pOleWindow;
    HRESULT hr2 = m_pIDlg.QueryInterface(&pOleWindow);
    if(SUCCEEDED(hr2))
    {
        hr2 = pOleWindow->GetWindow(&m_hWndProgDlg);
        if(SUCCEEDED(hr2))
        {
            // StartProgressDialog creates a new thread to host the progress window.
            // When the window receives WM_DESTROY message StopProgressDialog() wrongly
            // attempts to re-enable the parent in the calling thread (our thread),
            // after the progress window is destroyed and the progress thread has died.
            // When the progress window dies, the system tries to assign a new foreground window.
            // It cannot assign to hwndParent because StartProgressDialog (w/PROGDLG_MODAL) disabled the parent window.
            // So the system hands the foreground activation to the next process that wants it in the
            // system foreground queue. Thus we lose our right to recapture the foreground window.
            // The way to fix this bug is to insert a call to EnableWindow(hWndParent) in the WM_DESTROY
            // handler for the progress window in the progress thread.

            // To do that, we Subclass the progress dialog
            // Since the window and thread created by the progress dialog object live on a few
            // milliseconds after calling Stop() and Release(), we must not store anything
            // in member variables of this class but must only store everything in the window
            // itself: thus we use SetProp()/GetProp() to store the data.
            if (!m_isVisible)
            {
                m_OrigProc = (WNDPROC) SetWindowLongPtr(m_hWndProgDlg, GWLP_WNDPROC, (LONG_PTR) fnSubclass);
                SetProp(m_hWndProgDlg, L"ParentWindow", m_hWndParent);
                SetProp(m_hWndProgDlg, L"OrigProc", m_OrigProc);
            }
            if(immediately)
                ShowWindow(m_hWndProgDlg, SW_SHOW);
        }
    }

    m_isVisible = true;
    return hr;
}
开发者ID:,项目名称:,代码行数:48,代码来源:


示例13: IsItemInArray

bool IsItemInArray(IShellItem *psi, IObjectArray *poaRemoved)
{
	UINT cItems;
	if (FAILED(poaRemoved->GetCount(&cItems)))
		return false;

	bool fRet = false;
	for (UINT i = 0; !fRet && i < cItems; i++) {
		ATL::CComPtr<IShellItem> psiCompare;
		if (FAILED(poaRemoved->GetAt(i, IID_PPV_ARGS(&psiCompare))))
			continue;
		int iOrder;
		fRet = SUCCEEDED(psiCompare->Compare(psi, SICHINT_CANONICAL, &iOrder)) && (0 == iOrder);
	}
	return fRet;
}
开发者ID:AJH16,项目名称:TortoiseGit,代码行数:16,代码来源:JumpListHelpers.cpp


示例14: CreateShellLink

HRESULT CreateShellLink(PCWSTR pszArguments, PCWSTR pszTitle, int iconIndex, IShellLink **ppsl)
{
    ATL::CComPtr<IShellLink> psl;
    HRESULT hr = psl.CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER);
    if (FAILED(hr))
        return hr;

    WCHAR szAppPath[MAX_PATH];
    if (GetModuleFileName(NULL, szAppPath, _countof(szAppPath)) == 0)
    {
        hr = HRESULT_FROM_WIN32(GetLastError());
        return hr;
    }
    hr = psl->SetPath(szAppPath);
    if (FAILED(hr))
        return hr;

    hr = psl->SetArguments(pszArguments);
    if (FAILED(hr))
        return hr;

    hr = psl->SetIconLocation(szAppPath, iconIndex);
    if (FAILED(hr))
        return hr;

    ATL::CComPtr<IPropertyStore> pps;
    hr = psl.QueryInterface(&pps);
    if (FAILED(hr))
        return hr;

    PROPVARIANT propvar;
    hr = InitPropVariantFromString(pszTitle, &propvar);
    if (SUCCEEDED(hr))
    {
        hr = pps->SetValue(PKEY_Title, propvar);
        if (SUCCEEDED(hr))
        {
            hr = pps->Commit();
            if (SUCCEEDED(hr))
            {
                hr = psl.QueryInterface(ppsl);
            }
        }
        PropVariantClear(&propvar);
    }
    return hr;
}
开发者ID:,项目名称:,代码行数:47,代码来源:


示例15: CreateInstance

//
// IClassFactory implementation
//
HRESULT __stdcall CFactory::CreateInstance(IUnknown* pUnknownOuter, const IID& iid, void** ppv)
{
	if (!ppv)
		return E_POINTER;

	// Cannot aggregate.
	if (pUnknownOuter)
		return CLASS_E_NOAGGREGATION ;

	// Create component.
	ATL::CComPtr<GitWCRev> pA;
	pA.Attach(new (std::nothrow) GitWCRev()); // refcount set to 1 in constructor
	if (!pA)
		return E_OUTOFMEMORY ;

	return pA->QueryInterface(iid, ppv);
}
开发者ID:YueLinHo,项目名称:TortoiseGit,代码行数:20,代码来源:GitWCRevCOM.cpp


示例16: new

ListViewAccServer * ListViewAccServer::CreateProvider(HWND hControl, ListViewAccProvider * provider)
{
    ATL::CComPtr<IAccPropServices> pAccPropSvc;
    HRESULT hr = pAccPropSvc.CoCreateInstance(CLSID_AccPropServices, NULL, CLSCTX_SERVER);
    if (hr == S_OK && pAccPropSvc)
    {
        ListViewAccServer * pLVServer = new (std::nothrow) ListViewAccServer(pAccPropSvc);
        if (pLVServer)
        {
            pLVServer->m_pAccProvider = provider;

            MSAAPROPID propid = PROPID_ACC_HELP;
            pAccPropSvc->SetHwndPropServer(hControl, (DWORD)OBJID_CLIENT, CHILDID_SELF, &propid, 1, pLVServer, ANNO_CONTAINER);
            pLVServer->Release();
        }
        return pLVServer;
    }
    return NULL;
}
开发者ID:TortoiseGit,项目名称:tortoisesvn,代码行数:19,代码来源:ListViewAccServer.cpp


示例17: get_clsid

	void remote_host::get_clsid( const CATID& cat_id, LPCOLESTR server_name, CLSID& server_id )
	{
		DWPRINT( L"get_clsid( %s )\n", server_name );

		CATID Implist[1] = { cat_id };
		ATL::CComPtr<IEnumCLSID> iEnum;
		HRESULT result = root_->EnumClassesOfCategories( 1, Implist, 0, NULL, &iEnum );
		if (FAILED(result))
		{
			throw opc_exception( result, OLESTR("Failed to get enum for categeories") );
		}

		GUID glist;
		ULONG actual;
		while((result = iEnum->Next( 1, &glist, &actual )) == S_OK)
		{
			cotask_holder<OLECHAR> progID;
			cotask_holder<OLECHAR> userType;
			HRESULT res = root_->GetClassDetails( glist, progID.addr(), userType.addr() );

			if(FAILED(res))
			{
				throw opc_exception( res, OLESTR("Failed to get ProgId from ClassId") );
			}
			else
			{
				DWPRINT( L"progId = %s\n", progID );
				if ( lstrcmpW( progID.get(), server_name ) == 0 )
				{
					res = root_->CLSIDFromProgID( progID.get(), &server_id );

					if ( FAILED(res) )
					{
						throw opc_exception( res, OLESTR("IOPCServerList::CLSIDFromProgID - Failed to get ClassId from ProgId") );
					}

					return;
				}
			}
		}
	}
开发者ID:dreamer-dead,项目名称:libopc,代码行数:41,代码来源:opc_remote_host.cpp


示例18: openDoor

/**
 * Opens the Door! :)
 *
 * Parameters:
 * >szDoor
 * Path to lock device for the door.
 *
 * Returns:
 * N/A.
 */
void perco_exchange::openDoor(_In_ STLADD string_unique_ptr_t&& szDoor)
{
    ATL::CComPtr<PERCo_S20_SDK::IExchangeMain> percoXchg;
    if (SUCCEEDED(percoXchg.CoCreateInstance(__uuidof(PERCo_S20_SDK::CoExchangeMain))))
    {
        if (SUCCEEDED(percoXchg->SetConnect(PERCO_HOST, PERCO_PORT, PERCO_LOGIN, PERCO_PWD)))
        {
            BSTR szDBVersion;
            BSTR szSDKVersion;
            if (!percoXchg->CheckVersion(&szDBVersion, &szSDKVersion))
            {
                ATL::CComPtr<IXMLDOMDocument2> request = getSendCommandsRequest(std::move(szDoor));
                AtlTrace2(ATL::atlTraceGeneral, 0, "Sending the 'sendcommands' request.\r\n");
                if (request && SUCCEEDED(percoXchg->ExecuteCommand(request)))
                {
                    AtlTrace2(ATL::atlTraceGeneral, 0, "PERCo has responded to the 'sendcommands' request.\r\n");
                }
            }
            percoXchg->DisConnect();
        }
    }
    else
    {
        AtlTrace2(ATL::atlTraceCOM, 0, "'PERCo_S20_SDK::IExchangeMain' ain't registered.\r\n");
    }
}
开发者ID:ruslangaripov,项目名称:proving-ground,代码行数:36,代码来源:percoxch.cpp


示例19: get_clsid

	//*
	void local_host::get_clsid( const CATID& cat_id, LPCOLESTR server_name, CLSID& server_id )
	{
#if defined _DEBUG && defined _CONSOLE
		wprintf( L"get_clsid( %s )\n", server_name );
#endif

		CATID Implist[1] = { cat_id };
		ATL::CComPtr<IEnumCLSID> iEnum;
		HRESULT result = root_->EnumClassesOfCategories(1, Implist,0, NULL, &iEnum);
		if (FAILED(result))
		{
			throw opc_exception( result, OLESTR("Failed to get enum for categeories") );
		}

		GUID glist;
		ULONG actual;
		while((result = iEnum->Next(1, &glist, &actual)) == S_OK)
		{
			cotask_holder<OLECHAR> progID;

			HRESULT res = ProgIDFromCLSID(glist, progID.addr());			
			if(FAILED(res))
			{
				throw opc_exception( res, OLESTR("Failed to get ProgId from ClassId") );
			}
			else 
			{
#if defined _DEBUG && defined _CONSOLE
				wprintf( L"progId = %s\n", progID );
#endif
				if ( lstrcmpW( progID.get(), server_name ) == 0 )
				{
					server_id = glist;

					return;					
				}																
			}
		}
	}
开发者ID:DragonZX,项目名称:libopc,代码行数:40,代码来源:opc_local_host.cpp


示例20: dumpTypeLibrary

void dumpTypeLibrary(IDispatch* dispatchToDump, std::wostream& toOutput)
{
    toOutput << L"Start dumping!" << std::endl;
    COMUTILS_RETURN_IF_FAILED_START;

    UINT typeLibCount = 0;
    COMUTILS_RETURN_IF_FAILED(dispatchToDump->GetTypeInfoCount(&typeLibCount), toOutput, L"Failed to get type count");

    toOutput << "Type Library count: " << typeLibCount << std::endl;
    if (typeLibCount == 0) return;

    ATL::CComPtr<ITypeInfo> typeInfoOfObj = NULL;
    COMUTILS_RETURN_IF_FAILED(dispatchToDump->GetTypeInfo(NULL, LOCALE_SYSTEM_DEFAULT, &typeInfoOfObj), toOutput, L"Failed to get type info");
    toOutput << L"DEBUG: Got type info!" << std::endl;
    toOutput << L"DEBUG: Ptr to ITypeLib: " << std::hex << (int)typeInfoOfObj.p << std::dec << std::endl;

    ATL::CComPtr<ITypeLib> typeLibOfObj = NULL;
    UINT index = 0;
    COMUTILS_RETURN_IF_FAILED(typeInfoOfObj->GetContainingTypeLib(&typeLibOfObj, &index), toOutput, L"Failed to get type lib");
    toOutput << "DEBUG: Got type lib with index " << index << std::endl;
    
    /*

    TYPEATTR* descriptor = NULL;
    COMUTILS_RETURN_IF_FAILED(typeInfoOfObj->GetTypeAttr(&descriptor), toOutput, L"Failed to get descriptor!");
    toOutput << L"DEBUG: Got descriptor!" << std::endl;
    toOutput << std::hex << (UINT)descriptor << std::dec << std::endl;

    dumpTYPEATTR(descriptor, toOutput);
    
    
    typeInfoOfObj->ReleaseTypeAttr(descriptor);

    toOutput << L"DEBUG: Released descriptor!" << std::endl;

    */

}
开发者ID:zeriyoshi,项目名称:LunaDLL,代码行数:38,代码来源:GlobalFuncs.cpp



注:本文中的atl::CComPtr类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ atl::CHeapPtr类代码示例发布时间:2022-05-31
下一篇:
C++ io::IStreamReader类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap