case DISPID_DOCUMENTCOMPLETE:
{
#pragma region 获取页面总高度 HRESULT hr;
IDispatch *pdisp;
hr = m_pWebBrowser2->get_Document(&pdisp);
if(pdisp == NULL) break; //if NULL, we failed // 获得Html文档指针
IHTMLDocument2 *pDocument = NULL;
hr = pdisp->QueryInterface(IID_IHTMLDocument2, (void**)&pDocument);
if (pDocument == NULL) break; IHTMLElement *pBody = NULL;
hr = pDocument->get_body(&pBody);
if (pBody == NULL) break; IHTMLTextContainer *pCont = NULL;
pBody->QueryInterface(IID_IHTMLTextContainer, (LPVOID*)(&pCont));
if(pCont == NULL) break; // 获得页面总高度
long scroll_height = -;
if (FAILED(pCont->get_scrollHeight(&scroll_height)))
break; pBody->Release();
pCont->Release();
pDocument->Release();
pdisp->Release(); if (scroll_height != -)
m_dwHtmlHeight = scroll_height; if (NULL != m_pManager)
m_pManager->SendNotify(this, _T("document_complete"), scroll_height); #pragma endregion
    }

WebBrowser获取页面总高度的更多相关文章

  1. WinForm开发浏览器,WebBrowser获取页面内容,如何解决中文乱码

    WebBrowser的编码可以从文档对象中获得,将代码改为如下即可. System.IO.StreamReader getReader = new System.IO.StreamReader(thi ...

  2. 利用webBrowser获取页面iframe中的内容

    1.获取frame的document HtmlDocument htmlDoc = webBrowser1.Document;  htmlDoc = webBrowser1.Document.Wind ...

  3. C#中WebBrowser获取页面标签class值

    由于class是JavaScript的保留关键字 所以在C#中使用GetAttribute("className")来获取hmtlElement的class值 而不是GetAttr ...

  4. 利用webBrowser获取框架内Html页面内容

    原文:利用webBrowser获取框架内Html页面内容 利用webBrowser获取页面比较简单,MSDN下有示例,在这里不必多说. 可是一些 HTML 文档由“框架”构成,或可以存放它们自己独特 ...

  5. webbrowser取页面验证码

    碰到一个无比坑爹,外加蛋疼乳酸的问题.从昨天晚上发现bug,到今天下午解决问题,搞了大半天的时间.光是找问题就花了半天,解决问题的方法简单,但是方案的形成也是无比纠结的过程. 背景:webbrowse ...

  6. 获取WebBrowser全cookie 和 httpWebRequest 异步获取页面数据

    获取WebBrowser全cookie [DllImport("wininet.dll", CharSet = CharSet.Auto, SetLastError = true) ...

  7. js 和 jquery 获取页面和滚动条的高度 视口高度文档高度

    js 和 jquery 获取页面和滚动条的高度 //页面位置及窗口大小 function GetPageSize() { var scrW, scrH; if(window.innerHeight & ...

  8. jquery获取页面相关尺寸

    $(windows).width();获取页面可视宽度 $(windows).height();获取页面可视高度 $(document).height();获取页面内容的总高度 $(document) ...

  9. C# 网络编程之webBrowser获取网页url和下载网页中图片

    该文章主要是通过C#网络编程的webBrowser获取网页中的url并简单的尝试瞎子啊网页中的图片,主要是为以后网络开发的基础学习.其中主要的通过应用程序结合网页知识.正则表达式实现浏览.获取url. ...

随机推荐

  1. Solaris 10 改ip參考文档之二

    參考自:Cannot change IP address of Solaris[TM] 10 host (Doc ID 1007942.1) 本文不做翻译.全文转载. Symptoms Changin ...

  2. JUnit4.8.2源码分析-4 RunNotifier与RunListener

    JUnit4运行过程中,org.junit.runner.notification. RunListener和RunNotifier运用了观察者模式. 1.观察者 观察者Observer/Listen ...

  3. [LeetCode] 2. Add Two Numbers 两个数字相加 java语言实现 C++语言实现

    [LeetCode] Add Two Numbers 两个数字相加   You are given two non-empty linked lists representing two non-ne ...

  4. 中文版 ImageNet Classification with Deep Convolutional Neural Networks

    ImageNet Classification with Deep Convolutional Neural Networks 摘要 我们训练了一个大型深度卷积神经网络来将ImageNet LSVRC ...

  5. Springboot如何利用http请求控制器

    写好了接口,现在想用postman测试一下这个接口是否正确,想请问怎么传入请求参数?先谢谢了! Springboot如何利用http请求控制器 >> java这个答案描述的挺清楚的:htt ...

  6. Enable .Net 4.5 in IIS on Windows 8.1

    Setting up a new development box for myself I had forgotten all about the necessity to use theaspnet ...

  7. 关联对象 AssociatedObject 完全解析

    我们在 iOS 开发中经常需要使用分类(Category),为已经存在的类添加属性的需求,但是使用 @property 并不能在分类中正确创建实例变量和存取方法. 不过,通过 Objective-C ...

  8. 如何让iframe背景色透明框架页文件设置

    如何让iframe背景色透明框架页文件设置:<body style="background-color:transparent" > 或 <body bgColo ...

  9. hadoop从wordCount开始

    最近一段时间大数据很火,我有稍微有点java基础,自然选择了由java编写的hadoop框架,wordCount是hadoop中类似于java中helloWorld的存在,自然不能错过. packag ...

  10. perl脚本去除文件中重复数据

    今天第一天写博客,写的不好请大家多多指教,废话不多说了,干货送上: ############################################################# #!/u ...