本文整理汇总了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();
}
}
示例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();
}
}
示例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();
}
}
示例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();
}
}
示例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();
}
}
示例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();
}
}
示例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();
}
}
示例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();
}
}
示例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();
}
}
示例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();
}
}
示例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();
}
}
示例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();
}
}
示例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();
}
}
示例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();
}
}
示例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();
}
}