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;
            }
  • 相关阅读:
    sql-编程语句
    数据库语句基础3
    数据库语句 2
    sql常用的语句
    SQL语句
    锚点链接...
    sqlserver 三大范式
    sqlserver 约束
    c#SQLserver数据类型
    c#中switch语句用法
  • 原文地址:https://www.cnblogs.com/hubj/p/1735947.html
Copyright © 2011-2022 走看看