本文整理汇总了C++中atl::CString::Left方法的典型用法代码示例。如果您正苦于以下问题:C++ CString::Left方法的具体用法?C++ CString::Left怎么用?C++ CString::Left使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类atl::CString
的用法示例。
在下文中一共展示了CString::Left方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: WSCoCreateDotNetInstancePtr
IUnknownPtr GenericCLRLoader::WSCoCreateDotNetInstancePtr(const CLSID& clsid)
{
LPOLESTR szClsid;
HRESULT hr = StringFromCLSID(clsid, &szClsid);
if (FAILED(hr))
throw _com_error(hr);
ATL::CString sClsid = szClsid;
CoTaskMemFree(szClsid);
CRegKey rkCLSID;
hr = rkCLSID.Open(HKEY_CLASSES_ROOT, L"CLSID\\" + sClsid + L"\\InprocServer32", KEY_READ);
if (hr != ERROR_SUCCESS)
throw _com_error(HRESULT_FROM_WIN32(hr));
ATL::CString sAssembly = GetStringValue(rkCLSID, L"Assembly");
ATL::CString sClass = GetStringValue(rkCLSID, L"Class");
ATL::CString sCodeBase = GetStringValue(rkCLSID, L"CodeBase");
if (sAssembly.GetLength() == 0 || sClass.GetLength() == 0 || sCodeBase.GetLength() == 0)
throw _com_error(REGDB_E_CLASSNOTREG);
ATL::CString dllPath;
ATL::CString strFilePrefix(_T("file:///"));
if (sCodeBase.Left(strFilePrefix.GetLength()).MakeLower() == strFilePrefix)
{
dllPath = sCodeBase.Mid(strFilePrefix.GetLength()); // discard 'file:///'
}
else
{
dllPath = sCodeBase;
}
IUnknownPtr result;
hr = TheInstance()->CreateCOMObject(dllPath, sAssembly, sClass, &result);
if (FAILED(hr))
throw _com_error(hr);
return result;
}
示例2: IsMatchFilterElementHide
//.........这里部分代码省略.........
else if (attrIt->m_type == CFilterElementHideAttrType::CLASS)
{
CComBSTR bstrClassNames;
if (SUCCEEDED(pEl->get_className(&bstrClassNames)) && bstrClassNames)
{
value = bstrClassNames;
attrFound = true;
}
}
else if (attrIt->m_type == CFilterElementHideAttrType::ID)
{
CComBSTR bstrId;
if (SUCCEEDED(pEl->get_id(&bstrId)) && bstrId)
{
value = bstrId;
attrFound = true;
}
}
else
{
auto attributeValue = GetHtmlElementAttribute(*pEl, attrIt->m_bstrAttr);
if (attrFound = attributeValue.isAttributeFound)
{
value = ToCString(attributeValue.attributeValue);
}
}
if (attrFound)
{
if (attrIt->m_pos == CFilterElementHideAttrPos::EXACT)
{
// TODO: IE rearranges the style attribute completely. Figure out if anything can be done about it.
if (value != attrIt->m_value)
return false;
}
else if (attrIt->m_pos == CFilterElementHideAttrPos::STARTING)
{
if (value.Left(attrIt->m_value.GetLength()) != attrIt->m_value)
return false;
}
else if (attrIt->m_pos == CFilterElementHideAttrPos::ENDING)
{
if (value.Right(attrIt->m_value.GetLength()) != attrIt->m_value)
return false;
}
else if (attrIt->m_pos == CFilterElementHideAttrPos::ANYWHERE)
{
if (value.Find(attrIt->m_value) < 0)
return false;
}
else if (attrIt->m_value.IsEmpty())
{
return true;
}
}
else
{
return false;
}
}
if (m_predecessor)
{
CComPtr<IHTMLElement> pDomPredecessor;
HRESULT hr = S_FALSE;
switch (m_predecessor->m_type)
{
case ETraverserComplexType::TRAVERSER_TYPE_PARENT:
hr = pEl->get_parentElement(&pDomPredecessor);
break;
case ETraverserComplexType::TRAVERSER_TYPE_IMMEDIATE:
hr = S_FALSE;
CComQIPtr<IHTMLDOMNode> pPrevSiblingNode = pEl;
long type = 0;
while (pPrevSiblingNode && type != 1)
{
IHTMLDOMNode* tmpNode;
pPrevSiblingNode->get_previousSibling(&tmpNode);
pPrevSiblingNode.Attach(tmpNode);
if (pPrevSiblingNode)
{
hr = pPrevSiblingNode->get_nodeType(&type);
if (hr != S_OK)
pPrevSiblingNode.Release();
}
}
if (pPrevSiblingNode)
hr = pPrevSiblingNode.QueryInterface(&pDomPredecessor);
else
return false;
break;
}
if (hr != S_OK)
return false;
return m_predecessor->IsMatchFilterElementHide(pDomPredecessor);
}
return true;
}