1.我想IHTMLDocument3可能是版本问题,如果我不想重装,有简便解决方法吗?
2.另外,CComPtr<IHTMLDocument2>pDoc2和IHTMLDocument2 *pDoc2两种定义方法有什么区别?
3.再有,我对TT或者Maxthon这种浏览器获取pDoc2后,对里面元素遍历只有4个即HTML HEAD TITILE 和BODY,明显不对,怎么才能获得真实的元素呢?
恳请各位"前辈"指点迷津!

解决方案 »

  1.   

    1、升能SDK,或用VC7
    2、前者是智能指针,后者要对其进行操作Addref、Release操作
      

  2.   

    谢谢lion_wing!
    第三个问题继续求解。我用pelem->getinnerText得到是空值,getinnerHTML也只是几个tag,真奇怪啊。
      

  3.   

    wait until the readystate is "complete"
      

  4.   

    jiangsheng,是什么的readystate?maxthon中的页面是已经打开了的。
      

  5.   

    IHTMLDocument2::readyState Property
      

  6.   

    jiangsheng,getreadState得到已经是"complete",但innerText还是空的。
      

  7.   

    3、在DocumentComplete时,再做处理
      

  8.   

    我想了下,可能我得到的IWebBrowser2以及IHTMLDocument2是不对的。
    所以要请教下,对Maxthon多窗口浏览器怎么得到其当前窗口的IWebBrowser2和IHTMLDocument2.
      

  9.   

    /// <summary>
    /// Determins if the readystatus property of an HTML window and all its child frames are "complete"
    /// </summary>
    [ComVisible(false)]
            static public bool IsHtmlWindowReady(HtmlWindow window)
            {
    if (window == null)
    return false;
                try
                {
                    HTMLDocument    hdc = (HTMLDocument)window.Document.DomDocument;
                    if (hdc.readyState != "complete")
                        return false;
                    //Debug.WriteLine(
                    //   string.Format("Ready state of {0} is {1}",hdc.url,hdc.readyState));
                    foreach (HtmlWindow hw in window.Frames)
                    {
                        if (IsHtmlWindowReady(hw) == false)
                            return false;
                    }
                }
                catch (System.UnauthorizedAccessException e)
                {
                    Debug.WriteLine(e.Message);
                }
                //Debug.WriteLine("Checking frame readystate successful");
                return true;
            }
    /// <summary>
    /// Determins if the readystatus property of an HTML window and all its child frames are "complete"
    /// </summary>
    [CLSCompliant(false), ComVisible(false)]
    static public bool IsHtmlWindowReady(IHTMLWindow2 window)
    {
    if (window == null)
    return false;
    try
    {
    IHTMLDocument2 hdc = (IHTMLDocument2)window.document;
    if (hdc.readyState != "complete")
    return false;
    for (int i = 0; i < window.frames.length;i++ )
    {
    object o = i;
    IHTMLWindow2 hw = (IHTMLWindow2)window.frames.item(ref o);
    if (IsHtmlWindowReady(hw) == false)
    return false;
    }
    }
    catch (System.UnauthorizedAccessException e)
    {
    Debug.WriteLine(e.Message);
    }
    //Debug.WriteLine("Checking frame readystate successful");
    return true;
    }
      

  10.   

    谢谢!
    我发现我得到的不是maxthon里IE的文档指针而是window explore的指针,所以请教一下,怎么得到maxthon里当前窗口的IWebbrowser和IHTMLDocument指针?
      

  11.   

    用spy++查看MAXTHON的窗口结构
    然后通过HWND得到IWebbrowser2:
    http://blog.csdn.net/lion_wing/archive/2006/05/26/756105.aspx