社区
HTML/XML
帖子详情
如何通过IHTMLDocument2接口获取网页中的meta信息
sblsongdongf
2006-02-13 08:45:10
VC 7.0环境, IE
...全文
258
2
打赏
收藏
如何通过IHTMLDocument2接口获取网页中的meta信息
VC 7.0环境, IE
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
2 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
蒋晟
2006-02-14
打赏
举报
回复
HRESULT TBaseWebBrowserPageletCtrl::GetMetaCollection(IHTMLElementCollection** pCollec, IHTMLDocument2* pDocument)
{
CComPtr<IDispatch> lDispatch;
CComQIPtr<IHTMLDocument2> lDocument;
HRESULT lResult;
if (pDocument == NULL)
{
if (!m_BrowserTree)
return E_FAIL;
lResult = m_BrowserTree->get_Document(&lDispatch);
lDocument = lDispatch;
lDispatch = NULL;
ASSERT(SUCCEEDED(lResult) && lDocument);
if (FAILED(lResult) || (lDocument == NULL))
return E_FAIL;
}
else
{
lDocument = pDocument;
}
CComPtr<IHTMLElementCollection> lCollec;
lResult = lDocument->get_all(&lCollec);
ASSERT(SUCCEEDED(lResult) && lCollec);
if (FAILED(lResult) || (lCollec == NULL))
return E_FAIL;
lResult = lCollec->tags(CComVariant("META"), &lDispatch);
return lDispatch->QueryInterface(pCollec);
}
HRESULT TBaseWebBrowserPageletCtrl::CheckMetaTags()
{
CComQIPtr<IHTMLElementCollection> lCollec;
CComQIPtr<IHTMLMetaElement> lMetaElement;
CComPtr<IDispatch> lDispatch;
HRESULT lResult;
long lIndex = 0;
long lLength = 1;
lResult = GetMetaCollection(&lCollec);
if (SUCCEEDED(lResult) && lCollec)
{
lResult = lCollec->get_length(&lLength);
ASSERT(SUCCEEDED(lResult));
}
while (lIndex < lLength)
{
if (lCollec)
{
lResult = lCollec->item(CComVariant(lIndex), CComVariant(), &lDispatch);
lMetaElement = lDispatch;
lDispatch = NULL;
ASSERT(SUCCEEDED(lResult) && lMetaElement);
}
if (SUCCEEDED(lResult) && lMetaElement)
{
//
CComBSTR lName;
lResult = lMetaElement->get_name(&lName);
if (SUCCEEDED(lResult)
&& lName
&& (!wcsicmp(CComBSTR(KEEBOO_PRODUCT_NAME), lName)
|| !wcsicmp(CComBSTR(KEEBOO_COMPANY), lName)))
{
CComBSTR lMetaContent;
lResult = lMetaElement->get_content(&lMetaContent);
if (SUCCEEDED(lResult) && lMetaContent)
{
if (!wcsicmp(L"no-stretch", lMetaContent))
{
m_bNoStretch = TRUE;
}
else if (!wcsicmp(L"no-cache", lMetaContent))
{
CComQIPtr<IPageletSink> lPageletSink(m_pControlSite);
if (lPageletSink)
{
CComObject<TDeleteCacheEntryCallback>* lCallback;
CComQIPtr<IPageletDestroyCallback> lCBInterface;
CComObject<TDeleteCacheEntryCallback>::CreateInstance(&lCallback);
lCallback->SetPage(getModel());
lCBInterface = lCallback;
lPageletSink->SetDestroyCallback(lCallback);
}
}
else
{
TModelPtr<TPropertyObjectModel> lProp;
TModelPtr<TContentModel> lContentModel;
if (!wcsicmp(L"online-reload", lMetaContent))
{
getModel()->getContent(&lContentModel);
GetModelProperty<TContentModel>(lContentModel, T_CONTENT_NETWORK_PROPERTIES, &lProp, TRUE);
ASSERT(lProp);
if (lProp)
lProp->putBooleanField("online-reload", true);
}
else if (!wcsicmp(L"online-flush", lMetaContent))
{
getModel()->getContent(&lContentModel);
GetModelProperty<TContentModel>(lContentModel, T_CONTENT_NETWORK_PROPERTIES, &lProp, TRUE);
ASSERT(lProp);
if (lProp)
lProp->putBooleanField("online-flush", true);
}
}
}
}
}
lIndex++;
}
return S_OK;
}
CF-Codeforces Round #483 (Div. 2) D. XOR-pyramid 区间DP
For an array b of length m we define the function f as f(b)={b[1]if m=1f(b[1]⊕b[2],b[2]⊕b[3],…,b[m−1]⊕b[m])otherwise, where ⊕ is bitwise exclusive OR.For example, f(1,2,4,8)=f(1⊕2,2⊕4,4⊕8)=f(3,6,12)=...
D. XOR-pyramid Codeforces Round #483 (Div. 2) dp
题目链接:D. XOR-pyramid 题解:dp[i][j]表示以j开始长度为i的串的f()值,转移方程就很简单了dp[i][j]=(dp[i-1][j]^dp[i-1][j+1]); 然后求的是字段的最大值,用an数组维护dp的最大值就可以了。 #include<bits/stdc++.h> #define ll long long #defin...
Codeforces Round #483 (Div. 2) D. XOR-pyramid dp的应用
input: 61 2 4 8 16 3241 62 53 41 2 output: 6030123 刚开始没有看到要取最大值,就一直在哪里找哪里错了,仔细一看原来有一个最大的需要。 思路:用一个数组存好每两个数之间的^数值,然后比较^的数、以及推出^的两个数,在三个数
中
找最大值,然后存进数组
中
。 单纯的dp。 1 #include<bits/stdc++....
Codeforces Round #483 (Div. 2) [Thanks, Botan Investments and Victor Shaburov!] D. XOR-pyramid【递归DP】
D. XOR-pyramidtime limit per test2 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputFor an array bb of length mm we define the function ff asf(b)={b[1]if m=1f(b[1]⊕b[2]...
Codeforces Round #483 (Div. 2) D. XOR-pyramid(dp)
题意: 定义一个函数f(b),b对应一个数组,作用方式见题意。给你一个长度为n的序列b,然后给你q次询问,对于每次询问,给你l r,问你在[l,r]这段区间内所有子串
中
f的最大值为多少。 解析:定义f[l][r]为在[l,r]这个区间内函数f的结果,那么有: 当l=r时f[l][r]=b[l] 否则 f[l][r]=f[l][r...
HTML/XML
3,056
社区成员
8,075
社区内容
发帖
与我相关
我的任务
HTML/XML
VC/MFC HTML/XML
复制链接
扫一扫
分享
社区描述
VC/MFC HTML/XML
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章