本文整理汇总了C++中atl::CComPtr::CheckVersion方法的典型用法代码示例。如果您正苦于以下问题:C++ CComPtr::CheckVersion方法的具体用法?C++ CComPtr::CheckVersion怎么用?C++ CComPtr::CheckVersion使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类atl::CComPtr
的用法示例。
在下文中一共展示了CComPtr::CheckVersion方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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");
}
}
示例2: getIdentifiers
/**
* Gets identifiers map.
*
* Parameters:
* None.
*
* Returns:
* Identifiers map.
*/
perco_exchange::ids_t perco_exchange::getIdentifiers()
{
ids_t ids;
logger::const_ptr_t pLogger = logger::getInstance();
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 = getStaffRequest();
#pragma region log
pLogger->logNotify(logger::CategoryGeneral, IDS_EVENT_STAFF_REQUEST_SEND);
AtlTrace2(ATL::atlTraceGeneral, 0, "Sending the 'staff' request.\r\n");
#pragma endregion log the message
if (request && SUCCEEDED(percoXchg->GetData(request)))
{
#pragma region log
pLogger->logNotify(logger::CategoryGeneral, IDS_EVENT_STAFF_REQUEST_HANDLED);
AtlTrace2(ATL::atlTraceGeneral, 0, "PERCo has responded to the 'staff' request.\r\n");
#pragma endregion log the message
ids = parseStaffResponse(request);
#pragma region log
CStringUtil::const_ptr_t pStringUtil = CStringUtil::getInstance();
LPTSTR pszFormat;
size_t nLength;
if (CStringUtil::ResourceSuccess ==
pStringUtil->loadString(IDS_EVENT_T_RESPOND_SIZE, &pszFormat, &nLength))
{
const STLADD regex_type regex(TEXT("(?:[^%]*)(?:%[[:digit:]]{0,2}u){1,1}(?:[^%]*)"));
if (std::regex_match(pszFormat, pszFormat + nLength, regex))
{
nLength += 15;
CMemoryManager::pointer_t pMemoryManager = CMemoryManager::getInstance();
LPTSTR pszText = pMemoryManager->mAllocChars<LPTSTR>(nLength);
if (pszText)
{
nLength = _stprintf_s(pszText, nLength, pszFormat, ids.size());
pLogger->log(logger::CategoryGeneral, logger::SeverityNotify, pszText, nLength);
pMemoryManager->free(pszText);
}
}
pStringUtil->freeString(pszFormat);
}
AtlTrace2(ATL::atlTraceGeneral, 0, "The respond parsed (%u entries handled).\r\n", ids.size());
#pragma endregion log the message
}
}
percoXchg->DisConnect();
}
}
else
{
#pragma region log
pLogger->logError(logger::CategoryCOM, IDS_EVENT_IEXCHANGEMAIN_AINT_REGISTERED);
AtlTrace2(ATL::atlTraceCOM, 0, "'PERCo_S20_SDK::IExchangeMain' ain't registered.\r\n");
#pragma endregion log the message
}
return ids;
}