本文整理汇总了C++中CComBSTR::ToLower方法的典型用法代码示例。如果您正苦于以下问题:C++ CComBSTR::ToLower方法的具体用法?C++ CComBSTR::ToLower怎么用?C++ CComBSTR::ToLower使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CComBSTR
的用法示例。
在下文中一共展示了CComBSTR::ToLower方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: NodeExistsInParent
BOOL NodeExistsInParent(CComPtr<ItcProjectNode> owner_node, CComBSTR name) {
_ASSERT( owner_node != NULL );
if ((name.Length() > 0) && FAILED(name.ToLower()))
return FALSE;
CComPtr<ItcProjectNodeIterator> iterator;
if (FAILED( owner_node->CreateChildIterator(&iterator) )) {
return FALSE;
}
while (iterator->HasNext() == VARIANT_TRUE) {
CComPtr <ItcProjectNode> node;
if (FAILED( iterator->Next(&node) )) {
return FALSE;
}
CComBSTR caption;
if (SUCCEEDED( node->get_Caption(&caption) )) {
if ((caption.Length() == 0) || SUCCEEDED(caption.ToLower())) {
if (caption == name) {
return TRUE;
}
}
}
}
return FALSE;
}
示例2: isHtmlPage
bool isHtmlPage(IHTMLDocument2* doc)
{
CComBSTR type;
if (!SUCCEEDED(doc->get_mimeType(&type)))
{
return false;
}
if (!SUCCEEDED(type.ToLower()))
{
return false;
}
return wcsstr(combstr2cw(type), L"html") != NULL;
}
示例3: MapArenaDistribution
bstr_t Distribution::MapArenaDistribution()
{
CComBSTR bstr;
// See if distribution reference.
// FIXME: check if distreference exists in distributions
MappedValues & mymappedvalues(this->mappedvalues);
if(distreference!=_bstr_t(L"None"))
{
bstr = (BSTR) distributions[distreference].distname;
mymappedvalues=MappedValues(distributions[distreference].mappedvalues);
}
else
bstr = (BSTR) distname;
bstr.ToLower();
bstr_t arenaexpr;
if(bstr == L"exponential")
{
arenaexpr=L"EXPO(" + mymappedvalues[L"mean"] + L")";
}
if(bstr == L"poisson")
{
arenaexpr=L"POIS(" + mymappedvalues[L"mean"] + L")";
}
else if(bstr == L"normal")
{
arenaexpr=L"NORM(" + mymappedvalues[L"mean"] + L"," + mymappedvalues[L"deviation"] + L")";
}
else if(bstr == L"weibull")
{
arenaexpr=L"WEIB(" + mymappedvalues[L"scale"] + L"," + mymappedvalues[L"shape"] + ")";
}
else if(bstr == L"gamma")
{
arenaexpr=L"GAMM(" + mappedvalues[L"scale"] + L"," + mappedvalues[L"shape"] + ")";
}
else if(bstr == L"triagle")
{
arenaexpr=L"TRIA(" + mymappedvalues[L"minimum"] + L"," ;
arenaexpr+= mymappedvalues[L"mode"] + L",";
arenaexpr+= mymappedvalues[L"maximum"] + L")";
}
return arenaexpr;
}
示例4: RevealHiddenLinks
void CMSDNForumHelper::RevealHiddenLinks(IHTMLDocument2* pDocument)
{
CComBSTR url;
HRESULT hr=pDocument->get_URL(&url);
if(hr==S_OK)
{
url.ToLower();
CString urlString(url);
if(urlString.Find(_T("microsoft.com"))==-1)
return;
if(urlString.Find(_T("social"))==1)
return;
}
CComPtr<IHTMLElementCollection> linkElementCollection;
// Get the collection of images from the DOM.
hr = pDocument->get_links(&linkElementCollection);
if (hr == S_OK && linkElementCollection != NULL)
{
// Get the number of images in the collection.
long linkCount = 0;
hr = linkElementCollection->get_length(&linkCount);
if (hr == S_OK && linkCount > 0)
{
for (int i = 0; i < linkCount; i++)
{
CComVariant varItemIndex(i);
CComVariant varEmpty;
CComPtr<IDispatch> linkDispatch;
// Get the link out of the collection by index.
hr = linkElementCollection->item(varItemIndex, varEmpty, &linkDispatch);
if (hr == S_OK && linkDispatch != NULL)
{
//filter out hot spot on images
CComQIPtr<IHTMLAnchorElement> anchorElement(linkDispatch);
if(anchorElement==NULL) continue;
//query for the generic HTML element interface
CComQIPtr<IHTMLElement> linkElement(linkDispatch);
if (linkElement)
{
// ...then ask for the style interface.
CComPtr<IHTMLStyle> linkStyle;
hr = linkElement->get_style(&linkStyle);
// Set display="none" to hide the image.
if (hr == S_OK && linkStyle != NULL)
{
CComVariant linkCollor;
hr=linkStyle->get_color(&linkCollor);
if(linkCollor.vt==VT_BSTR)
{
CComBSTR linkCollorString(linkCollor.bstrVal);
if (hr == S_OK && linkCollorString.Length()>0)
{
linkStyle->put_backgroundColor(CComVariant(_T("red")));
linkStyle->put_color(CComVariant(_T("")));
CComBSTR href,text;
anchorElement->get_href(&href);
linkElement->get_innerText(&text);
CString newText;
newText.Format(_T("hidden link, possible spam: text: %s, url: %s"),text,href);
linkElement->put_innerText(CComBSTR(newText));
}
}
}
}
}
}
}
}
}
示例5: IsMatchFilterElementHide
bool CFilterElementHide::IsMatchFilterElementHide(IHTMLElement* pEl) const
{
HRESULT hr;
if (!m_tagId.IsEmpty())
{
CComBSTR id;
hr = pEl->get_id(&id);
if ((hr != S_OK) || (id != CComBSTR(m_tagId)))
{
return false;
}
}
if (!m_tagClassName.IsEmpty())
{
CComBSTR classNameBSTR;
hr = pEl->get_className(&classNameBSTR);
if (hr == S_OK)
{
CString className = classNameBSTR;
int start = 0;
CString specificClass;
bool foundMatch = false;
while ((specificClass = className.Tokenize(L" ", start)) != L"")
{
// TODO: Consider case of multiple classes. (m_tagClassName can be something like "foo.bar")
if (specificClass == m_tagClassName)
{
foundMatch = true;
}
}
if (!foundMatch)
{
return false;
}
}
}
if (!m_tag.IsEmpty())
{
CComBSTR tagName;
hr = pEl->get_tagName(&tagName);
tagName.ToLower();
if ((hr != S_OK) || (tagName != CComBSTR(m_tag)))
{
return false;
}
}
// Check attributes
for (std::vector<CFilterElementHideAttrSelector>::const_iterator attrIt = m_attributeSelectors.begin();
attrIt != m_attributeSelectors.end(); ++ attrIt)
{
ATL::CString value;
bool attrFound = false;
if (attrIt->m_type == CFilterElementHideAttrType::STYLE)
{
CComPtr<IHTMLStyle> pStyle;
if (SUCCEEDED(pEl->get_style(&pStyle)) && pStyle)
{
CComBSTR bstrStyle;
if (SUCCEEDED(pStyle->get_cssText(&bstrStyle)) && bstrStyle)
{
value = bstrStyle;
value.MakeLower();
attrFound = true;
}
}
}
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)
{
//.........这里部分代码省略.........