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;
            }
  • 相关阅读:
    3.17爸爸要回去了(之十一)
    爸爸丢了 (2013.3.10,确诊五天后,之十)
    Polyline转Polygon
    将一个应用程序添加做成windows服务
    找个输入IPoint在某个FeatureClass上距离最近的要素
    线程间操作无效: 从不是创建控件“label4”的线程访问它。
    删除文件夹下的文件和文件夹
    int组成时间值
    CRONTAB
    NFS
  • 原文地址:https://www.cnblogs.com/hubj/p/1735947.html
Copyright © 2011-2022 走看看