当前位置: 首页>>代码示例>>C++>>正文


C++ CComObject类代码示例

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


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

示例1: AFX_MANAGE_STATE

STDMETHODIMP CEDBS_Linien::get_Item(VARIANT *vntIndexKey, VARIANT *pVal)
{
	USES_CONVERSION;
	AFX_MANAGE_STATE(AfxGetStaticModuleState())

 HRESULT hResult;
 CComObject<CEDBS_Linie> *pobjLinie;
 POSITION pos;
 IDispatch *pIObjekt;
 CString key;
 long lx;

	switch(vntIndexKey->vt) {
	case VT_I4|VT_BYREF:
		if( 0 < *vntIndexKey->plVal && *vntIndexKey->plVal <= mlstLinien.GetCount() ) {
			pos = mlstLinien.GetHeadPosition();
			lx = 0;
			while( lx != *vntIndexKey->plVal && pos != NULL ) {
				lx++;
				pobjLinie = (CComObject<CEDBS_Linie>*)mlstLinien.GetNext(pos);
			};
			if( lx == *vntIndexKey->plVal ) {
				hResult = pobjLinie->QueryInterface(IID_IDispatch,(void**)&pIObjekt);
				pVal->vt = VT_DISPATCH;
				pVal->pdispVal = pIObjekt;
				hResult = S_OK;
			}
			else
				hResult = S_FALSE;
		}
		else {
			hResult = S_FALSE;
		}
		break;
	default:
		ASSERT(0);
		hResult = S_FALSE;
		break;
	}
	return hResult;
}
开发者ID:gsaralji,项目名称:TRiAS,代码行数:41,代码来源:EDBS_Linien.cpp

示例2: showModalDialog

STDMETHODIMP CLHTMLWindow::showModalDialog(/*[in]*/ BSTR dialog, /*[in]*/ VARIANT *varArgIn, /*[in]*/ VARIANT *varOptions, /*[out,retval]*/ VARIANT *varArgOut)
{
	CComObject<CLHTMLDialog>* pHTMLDialog;
	CComObject<CLHTMLDialog>::CreateInstance(&pHTMLDialog);
	if (pHTMLDialog)
	{
		pHTMLDialog->AddRef();

#if 0
		CComPtr<ILDOMDocument> document;
		document.CoCreateInstance(&document);

		VARIANT_BOOL success;
		document->load(_variant_t(dialog), &success);
#endif

		pHTMLDialog->Release();
	}

	return S_OK;
}
开发者ID:sigurdle,项目名称:FirstProject2,代码行数:21,代码来源:LHTMLWindow.cpp

示例3: EnumFormatEtc

STDMETHODIMP CTextObject::EnumFormatEtc(DWORD dwDirection, IEnumFORMATETC** ppEnumFormatEtc)
{
	if (dwDirection != DATADIR_GET && dwDirection != DATADIR_SET)
		return E_INVALIDARG;
	typedef CComEnum<IEnumFORMATETC, &IID_IEnumFORMATETC, FORMATETC, _Copy<FORMATETC>, CComSingleThreadModel> CEnumFORMATETC;
	CComObject<CEnumFORMATETC>* pEnumerator;
	HRESULT hRes = CComObject<CEnumFORMATETC>::CreateInstance(&pEnumerator);
	if (FAILED(hRes))
		return hRes;
	static FORMATETC formats[] =
	{
		{ CF_TEXT, NULL, DVASPECT_CONTENT, -1, SUPPORTED_MEDIUM_TYPES },
		{ CF_UNICODETEXT, NULL, DVASPECT_CONTENT, -1, SUPPORTED_MEDIUM_TYPES }
	};
	hRes = pEnumerator->Init(formats, formats + countof(formats), this, ATL::AtlFlagNoCopy);
	if (SUCCEEDED(hRes))
		hRes = pEnumerator->QueryInterface(ppEnumFormatEtc);
	if (FAILED(hRes))
		delete pEnumerator;
	return hRes;
}
开发者ID:lemonxiao0,项目名称:peerproject,代码行数:21,代码来源:TextObject.cpp

示例4: IEnumIDList_Constructor

/**************************************************************************
 *  IEnumIDList_Folder_Constructor
 *
 */
HRESULT IEnumIDList_Constructor(IEnumIDList **enumerator)
{
    CComObject<IEnumIDListImpl>                *theEnumerator;
    CComPtr<IEnumIDList>                    result;
    HRESULT                                    hResult;

    if (enumerator == NULL)
        return E_POINTER;
    *enumerator = NULL;
    ATLTRY (theEnumerator = new CComObject<IEnumIDListImpl>);
    if (theEnumerator == NULL)
        return E_OUTOFMEMORY;
    hResult = theEnumerator->QueryInterface(IID_PPV_ARG(IEnumIDList, &result));
    if (FAILED (hResult))
    {
        delete theEnumerator;
        return hResult;
    }
    *enumerator = result.Detach ();
    return S_OK;
}
开发者ID:,项目名称:,代码行数:25,代码来源:

示例5: GetAccessDenied

STDMETHODIMP InterfaceAntiSpam::get_DNSBlackLists(IInterfaceDNSBlackLists **pVal)
{
   try
   {
      if (!m_pConfig)
         return GetAccessDenied();

      CComObject<InterfaceDNSBlackLists>* pDNSBlackListsInterface = new CComObject<InterfaceDNSBlackLists>();
      pDNSBlackListsInterface->SetAuthentication(m_pAuthentication);
      pDNSBlackListsInterface->LoadSettings();
   
      pDNSBlackListsInterface->AddRef();
      *pVal = pDNSBlackListsInterface;
   
      return S_OK;
   }
   catch (...)
   {
      return COMError::GenerateGenericMessage();
   }
}
开发者ID:Bill48105,项目名称:hmailserver,代码行数:21,代码来源:InterfaceAntiSpam.cpp

示例6: GetPath

HRESULT STDMETHODCALLTYPE CProjectItemInfo::CreateConfigurationParams(ItcProjectNode * AParentNode, ItcProjectNodeConfigurationInfo * * Value)
{
	HRESULT hr;

	// Get location path
	CComBSTR path = GetPath(AParentNode);

	// Choose the name
	CComBSTR name = GetName(AParentNode, 0);

	CComObject<CPluginConfiguration>* conf;
	hr = CComObject<CPluginConfiguration>::CreateInstance(&conf);
	if (FAILED(hr)) return hr;
  
	conf->Initialize( name,
	                  path,
	                  AParentNode,
	                  m_messenger );

	return conf->QueryInterface(Value);
}
开发者ID:versionone,项目名称:VersionOne.Integration.TestComplete,代码行数:21,代码来源:ProjectItemInfo.cpp

示例7: GetDispatch

// GetDispatch --------------------------------------------------------------
LPDISPATCH CCodeListCtrl::GetDispatch()
{
#ifdef _ACTIVEX

   if( NULL == m_lpDispatch )
   {
      CComObject<CICodeList>* pNew = NULL;
      HRESULT hR = pNew->CreateInstance( &pNew );

      if( SUCCEEDED( hR ) )
      {
         pNew->AddRef();
         pNew->SetControl( this );
         m_lpDispatch = pNew;
      }
   }

#endif//#ifdef _ACTIVEX

   return m_lpDispatch;
}
开发者ID:DeegC,项目名称:ZeidonTools,代码行数:22,代码来源:codelistctrl.cpp

示例8: GetCurrentThreadId

HRESULT CAdminSession::FinalConstruct()
{
	// #define CAdminSession_TRACE_CONSTRUCTION
#ifdef CAdminSession_TRACE_CONSTRUCTION
	_TRACE_BEGIN
		DWORD id = GetCurrentThreadId();
	_TRACE_PART2("CAdminSession::FinalConstruct(): ThreadId = %d (0x%X)\n", id, id);
	_TRACE_PART1("\tRaw pointer = 0x%08X\n", this);
	_TRACE_END
#endif // CAdminSession_TRACE_CONSTRUCTION

		// Create the event sink object
		CComObject<CAdminSessionEventSink>* pEventSink = NULL;
	RETURN_FAILED(pEventSink->CreateInstance(&pEventSink));
	pEventSink->AddRef();
	pEventSink->Init(this);
	m_pEventSink = pEventSink;

	// Indicate success
	return S_OK;
}
开发者ID:AllegianceZone,项目名称:Allegiance,代码行数:21,代码来源:AdminSession.cpp

示例9: put_mux_type

STDMETHODIMP CMixerControl::put_mux_type(MIX_LINE newVal)
{
    CComObject<CMixerLine>* pLine = 0;
    IMixerLine* pILine = 0;
    HRESULT hr = 0;

    pLine = m_pDest->GetLine(newVal);
    if(!pLine) return MIX_E_NOTFOUND;

    if(FAILED(hr = pLine->QueryInterface(IID_IMixerLine, (void**)&pILine)))
    {
        return hr;
    }

    hr = put_mux_source(pILine);

    pILine->Release();
    pILine = 0;

	return hr;
}
开发者ID:thenfour,项目名称:Volumizer,代码行数:21,代码来源:MixerControl.cpp

示例10: get_Diagnostics

STDMETHODIMP InterfaceApplication::get_Diagnostics(IInterfaceDiagnostics **pVal)
{
    try
    {
        if (!authentication_->GetIsServerAdmin())
            return authentication_->GetAccessDenied();

        CComObject<InterfaceDiagnostics>* pInterfaceDiagnostics = new CComObject<InterfaceDiagnostics>;

        pInterfaceDiagnostics->SetAuthentication(authentication_);
        pInterfaceDiagnostics->AddRef();

        *pVal = pInterfaceDiagnostics;

        return S_OK;
    }
    catch (...)
    {
        return COMError::GenerateGenericMessage();
    }
}
开发者ID:digitalsoft,项目名称:hmailserver,代码行数:21,代码来源:InterfaceApplication.cpp

示例11: GetAccessDenied

STDMETHODIMP InterfaceAccounts::get_Item(long Index, IInterfaceAccount **pVal)
{
   try
   {
      if (!m_pAccounts)
         return GetAccessDenied();

      CComObject<InterfaceAccount>* pAccountInt = new CComObject<InterfaceAccount>();
      pAccountInt->SetAuthentication(m_pAuthentication);
   
      shared_ptr<HM::Account> pAccount = m_pAccounts->GetItem(Index);
   
      if (!pAccount)
         return DISP_E_BADINDEX;
      
      pAccountInt->AttachItem(pAccount);
      pAccountInt->AttachParent(m_pAccounts, true);
      pAccountInt->SetAuthentication(m_pAuthentication);
      pAccountInt->AddRef();
      *pVal = pAccountInt;
   
      return S_OK;
   }
   catch (...)
   {
      return COMError::GenerateGenericMessage();
   }
}
开发者ID:Bill48105,项目名称:hmailserver,代码行数:28,代码来源:InterfaceAccounts.cpp

示例12: __CHECK_POINTER

STDMETHODIMP CEtsDivColl::CopyToWithWeight( DOUBLE dWeight, IEtsDivColl* pDest , IEtsDivColl** ppVal)
{
	__CHECK_POINTER(ppVal);
	HRESULT hr = S_OK;
	try
	{
		if (pDest == NULL)
		{
			CComObject<CEtsDivColl>* pCustDivs; 
			_CHK(CComObject<CEtsDivColl>::CreateInstance(&pCustDivs),  _T("Fail to create dividend object."));
			pCustDivs->AddRef();
			pDest = pCustDivs;
		}
		EnumIterType iter = m_DivColl.begin();
		EnumIterType iterEnd = m_DivColl.end();
		DOUBLE dDate = 0;
		DOUBLE dAmount = 0;
		for(;iter != iterEnd; ++iter)
		{
			dDate = iter->first;
			dAmount = iter->second;
			pDest->Add(dDate ,  (dAmount * dWeight) );
		}
		if(ppVal)
		{
			*ppVal = pDest;
			pDest->AddRef();
		}

	}
	catch (_com_error& e) 
	{
		hr =  Error((PTCHAR)EgLib::CComErrorWrapper::ErrorDescription(e), IID_IEtsDivColl, e.Error());
	}
	catch(...)
	{
		hr =  Error( _T("Unhandled exception handled at CopyToWithWeight"), IID_IEtsDivColl, E_FAIL);
	}
	return hr;
}
开发者ID:AlexS2172,项目名称:IVRMstandard,代码行数:40,代码来源:EtsDivColl.cpp

示例13:

   String
   ScriptServer::Compile_(const String &sLanguage, const String &sFilename)
   {
      String sContents = FileUtilities::ReadCompleteTextFile(sFilename);

      if (sContents.IsEmpty())
         return "";

      // Create an instance of the script engine and execute the script.
      CComObject<CScriptSiteBasic>* pBasic;
      CComObject<CScriptSiteBasic>::CreateInstance(&pBasic);

      CComQIPtr<IActiveScriptSite> spUnk;

      if (!pBasic)
         return "ScriptServer:: Failed to create instance of script site.";

      spUnk = pBasic; // let CComQIPtr tidy up for us
      pBasic->Initiate(sLanguage, NULL);
      // pBasic->SetObjectContainer(pObjects);
      pBasic->AddScript(sContents);
      pBasic->Run();
      pBasic->Terminate();

      String sErrorMessage = pBasic->GetLastError();

      if (!sErrorMessage.IsEmpty())
         sErrorMessage = "File: " + sFilename + "\r\n" + sErrorMessage;

      return sErrorMessage;

   }
开发者ID:AimaTeam-hehai,项目名称:hmailserver,代码行数:32,代码来源:ScriptServer.cpp

示例14: _T

STDMETHODIMP CMmVaOptRootColl::Add(LONG Key, BSTR SortKey, IMmVaOptRootAtom* Value, IMmVaOptRootAtom** pRetVal)
{
	try
	{
		if(!Value)
		{
			CComErrorWrapper::ThrowError(E_INVALIDARG, _T("Cann't insert empty option root."));
		}

		if(m_collRef.find(Key) != m_collRef.end())
		{
			CComErrorWrapper::ThrowError(E_INVALIDARG, _T("Option root with the same key is already exists."));
		}

		if(!Value)
		{
			CComObject<CMmVaOptRootAtom>* pNewVal;
			__CHECK_HRESULT(CComObject<CMmVaOptRootAtom>::CreateInstance(&pNewVal), _T("Fail to add option root."));
			pNewVal->AddRef();
			if(FAILED(IMmVaOptRootCollImpl::Add(Key, CComBSTR(SortKey), pNewVal)))
			{
				pNewVal->Release();
				CComErrorWrapper::ThrowError(E_INVALIDARG, _T("Fail to add option root."));
			}
			*pRetVal = pNewVal;
		}
		else
		{
			__CHECK_HRESULT(IMmVaOptRootCollImpl::Add(Key, CComBSTR(SortKey), Value), _T("Fail to add option root."));
			Value->AddRef();
			*pRetVal = Value;
		}
	}
	catch(const _com_error& e)
	{
		return Error((PTCHAR)CComErrorWrapper::ErrorDescription(e), IID_IMmVaOptRootColl, e.Error());
	}

	return S_OK;
}
开发者ID:AlexS2172,项目名称:IVRM,代码行数:40,代码来源:MmVaOptRootColl.cpp

示例15: GetAccessDenied

STDMETHODIMP InterfaceDomain::get_Accounts(IInterfaceAccounts **pVal)
{
   try
   {
      if (!m_pObject)
         return GetAccessDenied();

      CComObject<InterfaceAccounts>* pItem = new CComObject<InterfaceAccounts>();
      pItem->SetAuthentication(m_pAuthentication);
   
      shared_ptr<HM::Accounts> pAccounts;
   
      if (m_pAuthentication->GetIsDomainAdmin())
         pAccounts = m_pObject->GetAccounts();
      else
         pAccounts = m_pObject->GetAccounts(m_pAuthentication->GetAccountID());
   
      if (pAccounts)
      {
         pItem->SetAuthentication(m_pAuthentication);
         pItem->Attach(pAccounts);
         pItem->SetDomain(m_pObject->GetID());
         pItem->AddRef();
         *pVal = pItem;
      }
   
      return S_OK;
   }
   catch (...)
   {
      return COMError::GenerateGenericMessage();
   }
}
开发者ID:Bill48105,项目名称:hmailserver,代码行数:33,代码来源:InterfaceDomain.cpp


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