关于IHTMLFrameCollection2的问题,急!!!!!!!!
最近有个任务要取一个网页上的数据,可是那个网页是用Frame做的,这还不是主要难处,主要是那个网页做了处理,如果直接打开Frame里的网页会回来主页去,而且网页加密了,我用IHTMLFrameCollection2去取数据,取来取去得不到,只能得到主页里的数据
网址是http://www.spbo.com,要得到比赛比分,大家帮帮忙啊,跪求高手了。
void CWebDlg::getFrame(IHTMLDocument2* doc, int index, CComPtr<IHTMLDocument2>& theFrame)
{
CComPtr<IHTMLDocument2> doc1 = (IHTMLDocument2*)(m_doc1.GetDocument());
CComPtr<IHTMLFramesCollection2> frames;
doc1->get_frames(&frames);
VARIANT frameRequested;
frameRequested.vt = VT_I4 ;
frameRequested.bstrVal = (BSTR)index;
VARIANT frameOut;
frames->item(&frameRequested, &frameOut);
CComPtr<IHTMLWindow2> window1;
frameOut.pdispVal->QueryInterface(IID_IHTMLWindow2, (void**)&window1);
window1->get_document(&theFrame);
}
调用
CComPtr<IHTMLDocument2> doc1 = (IHTMLDocument2*)(m_doc1.GetDocument());
CComPtr<IHTMLDocument2> pFrameDoc;
CComPtr<IHTMLElement> pElement;
CComPtr<IHTMLDocument2> pFrameDoc1;
CComPtr<IHTMLElement> pElement1;
BSTR str,s1;
CString temp,tmp;
doc1->get_body(&pElement);//取得框架内容
pElement->get_innerHTML(&str);
temp = str;
m_Show += temp;
m_Show += "\r\n■■■■■■■■■■■■■■■■■■■■■■■■\r\n";
getFrame(doc1,0,pFrameDoc);//取得下一个框架
pFrameDoc->get_body(&pElement);//取得框架内容
pElement->get_innerHTML(&str);
temp = str;
m_Show += temp;
m_Show += "\r\n■■■■■■■■■■■■■■■■■■■■■■■■\r\n";
pElement.Release();
doc1.Release();