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


C++ CComObject::Attach方法代码示例

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


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

示例1: get_DistributionLists

STDMETHODIMP InterfaceDomain::get_DistributionLists(IInterfaceDistributionLists **pVal)
{
   try
   {
      if (!m_pObject)
         return GetAccessDenied();

      if (!m_pAuthentication->GetIsDomainAdmin())
         return m_pAuthentication->GetAccessDenied();
   
      CComObject<InterfaceDistributionLists>* pItem = new CComObject<InterfaceDistributionLists>();
      pItem->SetAuthentication(m_pAuthentication);
   
      shared_ptr<HM::DistributionLists> pDistLists = m_pObject->GetDistributionLists();
      pDistLists->Refresh();
   
      if (pDistLists)
      {
         pItem->Attach(pDistLists);
         pItem->SetDomain(m_pObject->GetID());
         pItem->AddRef();
         *pVal = pItem;
      }
   
   
      return S_OK;
   }
   catch (...)
   {
      return COMError::GenerateGenericMessage();
   }
}
开发者ID:Bill48105,项目名称:hmailserver,代码行数:32,代码来源:InterfaceDomain.cpp

示例2: get_Recipients

STDMETHODIMP InterfaceDistributionList::get_Recipients(IInterfaceDistributionListRecipients **pVal)
{
   try
   {
      if (!m_pObject)
         return GetAccessDenied();

      CComObject<InterfaceDistributionListRecipients>* pItem = new CComObject<InterfaceDistributionListRecipients>();
      pItem->SetAuthentication(m_pAuthentication);
   
      pItem->SetListID(m_pObject->GetID());
      shared_ptr<HM::DistributionListRecipients> pRecipients = m_pObject->GetMembers();
   
      if (pRecipients)
      {
         pItem->Attach(pRecipients);
         pItem->AddRef();
         *pVal = pItem;
      }
   
   
      return S_OK;
   }
   catch (...)
   {
      return COMError::GenerateGenericMessage();
   }
}
开发者ID:Bill48105,项目名称:hmailserver,代码行数:28,代码来源:InterfaceDistributionList.cpp

示例3: GetAccessDenied

STDMETHODIMP 
InterfaceBackupManager::LoadBackup(BSTR sXMLFile, IInterfaceBackup **pVal)
{
   try
   {
      if (!m_pBackupManager)
         return GetAccessDenied();

      CComObject<InterfaceBackup>* pBackupInt = new CComObject<InterfaceBackup>();
      pBackupInt->SetAuthentication(m_pAuthentication);
   
      shared_ptr<HM::Backup> pBackup = m_pBackupManager->LoadBackup(sXMLFile);
   
      if (!pBackup)
         return DISP_E_BADINDEX;
   
      pBackupInt->Attach(pBackup);
      pBackupInt->AddRef();
      *pVal = pBackupInt;
   
      return S_OK;
   }
   catch (...)
   {
      return COMError::GenerateGenericMessage();
   }
}
开发者ID:Bill48105,项目名称:hmailserver,代码行数:27,代码来源:InterfaceBackupManager.cpp

示例4: get_Rules

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

        HRESULT hResult = EnsureDatabaseConnectivity_();
        if (hResult != S_OK)
            return hResult;

        CComObject<InterfaceRules >* pItem = new CComObject<InterfaceRules >();
        pItem->SetAuthentication(authentication_);

        std::shared_ptr<HM::Rules> pRules = std::shared_ptr<HM::Rules>(new HM::Rules(0));

        if (pRules)
        {
            pRules->Refresh();
            pItem->Attach(pRules);
            pItem->AddRef();
            *pVal = pItem;
        }

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

示例5: GetAccessDenied

STDMETHODIMP 
InterfaceIMAPFolders::get_ItemByDBID(long DBID, IInterfaceIMAPFolder **pVal)
{
   try
   {
      if (!m_pObject)
         return GetAccessDenied();

      CComObject<InterfaceIMAPFolder>* pIMAPFolderInt = new CComObject<InterfaceIMAPFolder>();
      pIMAPFolderInt->SetAuthentication(m_pAuthentication);
   
      shared_ptr<HM::IMAPFolder> pIMAPFolder = m_pObject->GetItemByDBID(DBID);
   
      if (!pIMAPFolder)
         return DISP_E_BADINDEX;  
   
      pIMAPFolderInt->Attach(pIMAPFolder);
      pIMAPFolderInt->AttachParent(m_pObject, true);
      pIMAPFolderInt->AddRef();
      *pVal = pIMAPFolderInt;
   
      return S_OK;
   }
   catch (...)
   {
      return COMError::GenerateGenericMessage();
   }
}
开发者ID:jrallo,项目名称:hMailServer,代码行数:28,代码来源:InterfaceIMAPFolders.cpp

示例6: GetAccessDenied

STDMETHODIMP 
InterfaceIMAPFolder::get_SubFolders(IInterfaceIMAPFolders **pVal)
{
   try
   {
      if (!m_pObject)
         return GetAccessDenied();

      CComObject<InterfaceIMAPFolders>* pItem = new CComObject<InterfaceIMAPFolders >();
      pItem->SetAuthentication(m_pAuthentication);
   
      boost::shared_ptr<HM::IMAPFolders> pFolders = m_pObject->GetSubFolders();
   
      if (pFolders)
      {
         pItem->Attach(pFolders);
         pItem->AddRef();
         *pVal = pItem;
      }
   
      return S_OK;
   }
   catch (...)
   {
      return COMError::GenerateGenericMessage();
   }
}
开发者ID:bogri5520,项目名称:hMailServer,代码行数:27,代码来源:InterfaceIMAPFolder.cpp

示例7: get_Recipients

STDMETHODIMP InterfaceMessage::get_Recipients(IInterfaceRecipients**pVal)
{
   try
   {
      if (!m_pObject)
         return GetAccessDenied();

      CComObject<InterfaceRecipients>* pItem = new CComObject<InterfaceRecipients>();
      pItem->SetAuthentication(m_pAuthentication);
   
      shared_ptr<HM::Message> pMessage = _GetMessageData()->GetMessage();
   
      if (pMessage)
      {
         pItem->Attach(pMessage);
         pItem->AddRef();
         *pVal = pItem;
      }
   
      return S_OK;
   }
   catch (...)
   {
      return COMError::GenerateGenericMessage();
   }
}
开发者ID:jrallo,项目名称:hMailServer,代码行数:26,代码来源:InterfaceMessage.cpp

示例8: get_Actions

STDMETHODIMP InterfaceRule::get_Actions(IInterfaceRuleActions **pVal)
{
   try
   {
      if (!m_pObject)
         return GetAccessDenied();

      CComObject<InterfaceRuleActions>* pItem = new CComObject<InterfaceRuleActions >();
   
      boost::shared_ptr<HM::RuleActions> pRuleActions = m_pObject->GetActions();
   
      if (pRuleActions)
      {
         pItem->Attach(pRuleActions);
         pItem->AddRef();
         *pVal = pItem;
      }
   
      return S_OK;
   }
   catch (...)
   {
      return COMError::GenerateGenericMessage();
   }
}
开发者ID:bogri5520,项目名称:hMailServer,代码行数:25,代码来源:InterfaceRule.cpp

示例9: get_DomainAliases

STDMETHODIMP InterfaceDomain::get_DomainAliases(IInterfaceDomainAliases **pVal)
{
   try
   {
      if (!m_pObject)
         return GetAccessDenied();

      if (!m_pAuthentication->GetIsDomainAdmin())
         return m_pAuthentication->GetAccessDenied();
   
      CComObject<InterfaceDomainAliases>* pItem = new CComObject<InterfaceDomainAliases>();
      pItem->SetAuthentication(m_pAuthentication);
   
      shared_ptr<HM::DomainAliases> pDA = shared_ptr<HM::DomainAliases>(new HM::DomainAliases(m_pObject->GetID()));
   
      if (pDA)
      {
         // Refresh the collection from the database.
         pDA->Refresh();
   
         pItem->Attach(pDA);
         pItem->AddRef();
         *pVal = pItem;
      }
   
   
      return S_OK;
   }
   catch (...)
   {
      return COMError::GenerateGenericMessage();
   }
}
开发者ID:Bill48105,项目名称:hmailserver,代码行数:33,代码来源:InterfaceDomain.cpp

示例10: get_IMAPFolders

STDMETHODIMP InterfaceAccount::get_IMAPFolders(IInterfaceIMAPFolders **pVal)
{
   try
   {
      if (!m_pObject)
         return GetAccessDenied();

      if (m_pObject->GetID() == 0)
         return DISP_E_BADINDEX;  
   
      CComObject<InterfaceIMAPFolders>* pItem = new CComObject<InterfaceIMAPFolders >();
      pItem->SetAuthentication(m_pAuthentication);
   
      shared_ptr<HM::IMAPFolders> pFolders = HM::IMAPFolderContainer::Instance()->GetFoldersForAccount(m_pObject->GetID());
   
      if (pFolders)
      {
         pItem->Attach(pFolders);
         pItem->AddRef();
         *pVal = pItem;
      }
   
      return S_OK;
   }
   catch (...)
   {
      return COMError::GenerateGenericMessage();
   }
}
开发者ID:Bill48105,项目名称:hmailserver,代码行数:29,代码来源:InterfaceAccount.cpp

示例11: get_Rules

STDMETHODIMP InterfaceAccount::get_Rules(IInterfaceRules **pVal)
{
   try
   {
      if (!m_pObject)
         return GetAccessDenied();

      CComObject<InterfaceRules >* pItem = new CComObject<InterfaceRules >();
      pItem->SetAuthentication(m_pAuthentication);
   
      shared_ptr<HM::Rules> pRules = m_pObject->GetRules();
   
      if (pRules)
      {
         pItem->Attach(pRules);
         pItem->AddRef();
         *pVal = pItem;
      }
   
      return S_OK;
   }
   catch (...)
   {
      return COMError::GenerateGenericMessage();
   }
}
开发者ID:Bill48105,项目名称:hmailserver,代码行数:26,代码来源:InterfaceAccount.cpp

示例12: get_FetchAccounts

STDMETHODIMP InterfaceAccount::get_FetchAccounts(IInterfaceFetchAccounts **pVal)
{
   try
   {
      if (!m_pObject)
         return GetAccessDenied();

      CComObject<InterfaceFetchAccounts>* pItem = new CComObject<InterfaceFetchAccounts >();
      pItem->SetAuthentication(m_pAuthentication);
   
      shared_ptr<HM::FetchAccounts> pFetchAccounts = shared_ptr<HM::FetchAccounts>(new HM::FetchAccounts(m_pObject->GetID()));
   
      pFetchAccounts->Refresh();
   
      if (pFetchAccounts)
      {
         pItem->Attach(pFetchAccounts);
         pItem->AddRef();
         *pVal = pItem;
      }
   
      return S_OK;
   }
   catch (...)
   {
      return COMError::GenerateGenericMessage();
   }
}
开发者ID:Bill48105,项目名称:hmailserver,代码行数:28,代码来源:InterfaceAccount.cpp

示例13: get_Messages

STDMETHODIMP InterfaceAccount::get_Messages(IInterfaceMessages **pVal)
{
   try
   {
      if (!m_pObject)
         return GetAccessDenied();

      CComObject<InterfaceMessages>* pMessages = new CComObject<InterfaceMessages>();
      pMessages->SetAuthentication(m_pAuthentication);
   
      shared_ptr<HM::Messages> pMsgs = m_pObject->GetMessages();
   
      if (!pMsgs)
         return DISP_E_BADINDEX;  
   
      pMessages->Attach(pMsgs);
      pMessages->AddRef();
      *pVal = pMessages;
   
      return S_OK;
   }
   catch (...)
   {
      return COMError::GenerateGenericMessage();
   }
}
开发者ID:Bill48105,项目名称:hmailserver,代码行数:26,代码来源:InterfaceAccount.cpp

示例14: get_ItemByName

STDMETHODIMP InterfaceLanguages::get_ItemByName(BSTR ItemName, IInterfaceLanguage **pVal)
{
   try
   {
      CComObject<InterfaceLanguage>* pInterfaceLanguage = new CComObject<InterfaceLanguage>();
   
      boost::shared_ptr<HM::Language> pLanguage = HM::Languages::Instance()->GetLanguage(ItemName);
   
      if (!pLanguage)
         return DISP_E_BADINDEX;
   
      pInterfaceLanguage->Attach(pLanguage);
      pInterfaceLanguage->AddRef();
   
      *pVal = pInterfaceLanguage;
   
      return S_OK;
   }
   catch (...)
   {
      return COMError::GenerateGenericMessage();
   }
}
开发者ID:bogri5520,项目名称:hMailServer,代码行数:23,代码来源:InterfaceLanguages.cpp

示例15: get_WhiteListAddresses

STDMETHODIMP InterfaceAntiSpam::get_WhiteListAddresses(IInterfaceWhiteListAddresses **pVal)
{
   try
   {
      if (!m_pConfig)
         return GetAccessDenied();

      if (!m_pConfig)
         return DISP_E_BADINDEX;
   
      CComObject<InterfaceWhiteListAddresses>* pGLWhiteList = new CComObject<InterfaceWhiteListAddresses>();
      pGLWhiteList->SetAuthentication(m_pAuthentication);
      pGLWhiteList->Attach(HM::Configuration::Instance()->GetAntiSpamConfiguration().GetWhiteListAddresses());
      pGLWhiteList->AddRef();
   
      *pVal = pGLWhiteList;
   
      return S_OK;
   }
   catch (...)
   {
      return COMError::GenerateGenericMessage();
   }
}
开发者ID:Bill48105,项目名称:hmailserver,代码行数:24,代码来源:InterfaceAntiSpam.cpp


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