zoukankan      html  css  js  c++  java
  • 用API获得Internet Explorer_Server类的HTML

      

      首先要找到含有Internet Explorer_Server类句柄,

      HTMLDocumentClass  result = (HTMLDocumentClass)documentFromDOM(hWnd.ToInt32());

      result.activeElement.innerHTML就得到所有HTML

      

    private static IHTMLDocument2 documentFromDOM(int hWnd)
            {
                 IHTMLDocument2 document=null;

                int lRes=0;
                int lngMsg = NativeMethods.RegisterWindowMessage("WM_HTML_GETOBJECT");
                Guid IID_IHTMLDocument = new Guid("626FC520-A41E-11CF-A731-00A0C9082637");
                if (lngMsg != 0)
                {
                    NativeMethods.SendMessageTimeout(hWnd, lngMsg, 0, 0, NativeMethods.SMTO_ABORTIFHUNG, 1000, ref lRes);
                    if (!(bool)(lRes == 0))
                    {
                        int hr = NativeMethods.ObjectFromLresult(lRes, ref IID_IHTMLDocument, 0, ref document);
                        if ((bool)(document == null))
                        {
                            MessageBox.Show("No IHTMLDocument Found!", "Warning");
                        }
                    }
                }


                return document;
            }
  • 相关阅读:
    java 包
    数据库查询操作练习
    solr全文检索实现原理
    前端页面设计问题小计
    送给自己的九封信
    bootstrap-table初使用
    bootstrap-treeview初使用
    windows:plsql配置oracle连接
    maven的安装和配置
    cxf+spring+restful简单接口搭建
  • 原文地址:https://www.cnblogs.com/hubj/p/1735947.html
Copyright © 2011-2022 走看看