获得Frame或IFrame中的IHTMLDocumnet2接口
来源:互联网 发布:linux 内核编程 编辑:程序博客网 时间:2024/06/08 18:38
IHTMLDocument2* GetDocFromFrame(IHTMLDocument2* pDoc2)
{
CComPtr<IHTMLDocument3> pDoc3;
CComPtr<IHTMLDocument2> pDoc2Frame;
hr = pDoc2->QueryInterface(IID_IHTMLDocument3,(void**)&pDoc3) ;
if(hr==S_OK)
{
CComBSTR bstrName("FRAME");//CComBSTR bstrName("IFRAME");
CComPtr<IHTMLElementCollection> pElemCollFrame;
hr=pDoc3->getElementsByTagName(bstrName,&pElemCollFrame);
if (hr!=S_OK) return NULL;
long pLength;
hr=pElemCollFrame->get_length(&pLength);
if(hr!=S_OK) return NULL;
for(int i=0;i<pLength;i++)
{
IDispatch *pDispFrame=NULL;
CComVariant vIndex=i;
hr=pElemCollFrame->item(vIndex,vIndex,&pDispFrame);
if(hr!=S_OK) continue;
CComPtr<IHTMLElement> pElemFrame;
hr=pDispFrame->QueryInterface(IID_IHTMLElement,(void**)&pElemFrame);
if(hr!=S_OK) continue;
CComPtr<IHTMLFrameBase2> pFrameBase2;
hr=pElemFrame->QueryInterface(IID_IHTMLFrameBase2,(void**)&pFrameBase2);
if(hr!=S_OK) continue;
CComPtr<IHTMLWindow2> pWindow2;
hr=pFrameBase2->get_contentWindow(&pWindow2);
if(hr==S_OK)
{
hr=pWindow2->get_document(&pDoc2Frame);
if (hr==S_OK)
{
return pDoc2Frame;
}
}
}
pDispFrame->Release();
}
return NULL;
}
- 获得Frame或IFrame中的IHTMLDocumnet2接口
- 获得Frame或Iframe中的IHTMLDocumnet2接口
- Html中的iframe,frameset frame
- iframe或frame:高度自动变化
- HTML中的Frame与Iframe框架属性
- 获得iframe中的控件值
- iframe与frame(即frameset中的frame)的区别
- iframe / frame
- iframe frame
- iframe frame
- 使用了iframe框架,而且iframe里面嵌套的frame框架 ,弹出框出现zDialog.js中的“topWin.Dialog._Array为空或不是对象”。(开发笔记3)
- P3P 解决iframe或frame跨域读取session
- Javascript里,把URL发给指定的iframe或frame
- JavaScript 跨frame或iframe操作对象 | 黄乔国PHP
- 获得 frame
- JS获得iframe中的window对象
- 获得页面iframe中文本框中的值
- 用JS操作FRAME中的IFRAME及其内容
- 入門 06 - Query介面
- 入門 07 - 更新,刪除資料
- C#/VB.NET 转义字符
- [学生日记] 9月5号
- 经济学的品行
- 获得Frame或IFrame中的IHTMLDocumnet2接口
- C#编码规范
- 制作exe的几种方式
- 写了那么多,郁闷
- 向后台模拟按键时发现的棘手问题,急!!~_~
- 乘WEB 2.0漫游虚拟太空
- 近期怪事特别多
- 入門 08 - 繼承映射1
- 得到MID子窗口指针