Internet Explorer_Server内容获取
来源:互联网 发布:红楼梦贾迎春知乎 编辑:程序博客网 时间:2024/05/21 23:00
2010-07-13 20:46promiseclx | 分类:网站使用 | 浏览819次
Internet Explorer_Server内容获取 使用vc怎么实现呀?我整了好久没弄出来谢谢了我有更好的答案
按默认排序|按时间排序
1条回答
检举|2012-04-21 18:00红楼妓男|六级
首先这里假设你已经获取到Internet Explorer_Server窗口的句柄,假设为hwndIE:HWND。CoInitialize(NULL); CComPtr<IHTMLDocument2> pDoc2; string strTemp=""; HINSTANCE hinst=::LoadLibrary("OLEACC.DLL"); if(hinst!=NULL) { LRESULT lres; UINT unMsg=::RegisterWindowMessage(_T("WM_HTML_GETOBJECT")); ::SendMessageTimeout(hwndIE,unMsg,0L,0L,SMTO_ABORTIFHUNG,1000,(DWORD*)&lres); LPFNOBJECTFROMLRESULT pfObjectFromLresult=(LPFNOBJECTFROMLRESULT)::GetProcAddress(hinst,_T("ObjectFromLresult")); if(pfObjectFromLresult!=NULL) { HRESULT hres; hres=(*pfObjectFromLresult)(lres,IID_IHTMLDocument2,0,(void**)&pDoc2); if(SUCCEEDED(hres)) { CComPtr<IHTMLElement> pHtmlElem; hres=pDoc2->get_body(&pHtmlElem); BSTR bstrText=NULL; pHtmlElem->get_innerText(&bstrText); _bstr_t _bstrTemp(bstrText,false); //strTemp=(char*)_bstr_t(bstrText); strTemp=(char*)_bstrTemp; } } ::FreeLibrary(hinst); } CoUninitialize(); CoInitialize(NULL);CComPtr<IHTMLDocument2> pDoc2;string strTemp="";HINSTANCE hinst=::LoadLibrary("OLEACC.DLL");if(hinst!=NULL) {LRESULT lres;UINT unMsg=::RegisterWindowMessage(_T("WM_HTML_GETOBJECT"));::SendMessageTimeout(hwndIE,unMsg,0L,0L,SMTO_ABORTIFHUNG,1000,(DWORD*)&lres);LPFNOBJECTFROMLRESULT pfObjectFromLresult=(LPFNOBJECTFROMLRESULT)::GetProcAddress(hinst,_T("ObjectFromLresult"));if(pfObjectFromLresult!=NULL) {HRESULT hres;hres=(*pfObjectFromLresult)(lres,IID_IHTMLDocument2,0,(void**)&pDoc2);if(SUCCEEDED(hres)) {CComPtr<IHTMLElement> pHtmlElem;hres=pDoc2->get_body(&pHtmlElem);BSTR bstrText=NULL;pHtmlElem->get_innerText(&bstrText);_bstr_t _bstrTemp(bstrText,false);//strTemp=(char*)_bstr_t(bstrText);strTemp=(char*)_bstrTemp;}}::FreeLibrary(hinst);}CoUninitialize(); 好了,现在strTemp中已经包含了Internet Explorer_Server窗口的内容了。 对了,记得包含头文件:[cpp] view plaincopyprint?#include <mshtml.h> #include <atlbase.h> #include <oleacc.h> #include <string> #include <comdef.h> using std::string;
评论
- Internet Explorer_Server内容获取
- Internet Explorer_Server内容获取
- VB 获取 Internet Explorer_Server 里面的内容
- VB 获取 Internet Explorer_Server 里面的内容
- 如果知道“Internet Explorer_Server”窗口去获取IWebbrowser2接口
- Internet Explorer_Server 分析利器(下载)
- Internet Explorer_Server类是个什么类
- 开源小工具一:获取客户端内嵌IE控件(Internet Explorer_Server)的URL
- 根据Internet Explorer_Server窗口得到IHtmlDocument2
- 根据Internet Explorer_Server窗口得到IHtmlDocument2接口
- 如何从Internet Explorer_Server窗口句柄获得IHTMLDocument
- 根据Internet Explorer_Server窗口得到IHtmlDocument2接口(IE编程)
- 通过其他程序的Internet Explorer_Server句柄打开网页
- 已知IWebBrowser2接口,如何获得其Internet Explorer_Server窗口句柄?
- 获取其他进程中“Internet Explorer_TridentCmboBx”的内容
- Internet信息获取能力
- Internet信息获取能力
- Internet信息获取能力
- 学习Gobject
- VIM使用
- 先进的开发框架—理解什么是Spring
- 软件工程 – 总结
- 使用JS编写一段面向对象的代码
- Internet Explorer_Server内容获取
- 什么是ORM?为什么要使用ORM?
- 根据一个值查找表,根据表名查询出表的基础属性
- 9.3
- Spring3.0 mvc --@RequestParam/@PathVariable区别
- Shader学习笔记,通过GLSL实现 (转载)
- 内核态进程管理器Intercessor和实现细节
- 解决企业管理器开启报错:MMC 不能打开文件的问题
- 先进的框架Spring(2)