rt

解决方案 »

  1.   

    //项目中添加Micrsoft.mshtml引用private void webBrowser1_Navigated(object sender, WebBrowserNavigatedEventArgs e)
    {
        IHTMLDocument2 vDocument = (IHTMLDocument2)webBrowser1.Document.DomDocument;
        foreach (IHTMLElement vElement in vDocument.all)
            if (vElement.tagName.ToUpper() == "FRAME")
            {
                IHTMLFrameBase2 vFrameBase2 = vElement as IHTMLFrameBase2;
                //TODO : vFrameBase2
            }
    }
      

  2.   

    //项目中添加Micrsoft.mshtml引用private void webBrowser1_Navigated(object sender, WebBrowserNavigatedEventArgs e)
    {
        IHTMLDocument2 vDocument = (IHTMLDocument2)webBrowser1.Document.DomDocument;
        foreach (IHTMLElement vElement in vDocument.all)
            if (vElement.tagName.ToUpper() == "FRAME")
            {
                IHTMLFrameBase2 vFrameBase2 = vElement as IHTMLFrameBase2;
                //TODO : vFrameBase2
            }
    }哪儿错?
      

  3.   

    不是我要的效果!我想操作已开网页下Frame中的Frame的文本框内容!我现在只能取到第一个Frame
    用的是下面的方法            HTMLDocument myDoc = (HTMLDocument)axWb.Document;
                mshtml.IHTMLWindow2 oWin = myDoc.parentWindow;
                mshtml.FramesCollection myFrame = oWin.frames;
                mshtml.IHTMLWindow2 getWin;            //textBox1.Text = myDoc.body.innerHTML;
                object x;
                for (int i = 0; i < myFrame.length; i++)
                {
                    x = i;
                    getWin = (mshtml.IHTMLWindow2)myFrame.item(ref x);
                    textBox1.Text += i+"."+getWin.document.nameProp+"\r\n";
                    textBox1.Text += getWin.document.body.innerHTML+"\r\n";
                }
      

  4.   

    每个Frame都在一个Frames对像数组中,一个一个慢慢试吧!调整一下f的值就可以了.
    mshtml.IHTMLDocument2 doc = (mshtml.IHTMLDocument2)axWebBrowser1.Document;
    object f=1;
    mshtml.HTMLWindow2Class w2=(mshtml.HTMLWindow2Class)doc.frames.item(ref f);
    mshtml.IHTMLDocument2 doc2 = (mshtml.IHTMLDocument2)w2.document;
    textBox1.Text =doc2.body.innerHTML;
      

  5.   

    HTMLDocument doc = (HTMLDocument)axWb.Document;
                object j;
                for (int i = 0; i < doc.parentWindow.frames.length; i++)
                {
                    j = i;
                    HTMLWindow2Class frame = doc.parentWindow.frames.item(ref j) as HTMLWindow2Class;
                    MessageBox.Show(frame.name);
                }
      

  6.   

    这个问题,我也遇到了,只能获取到第1个页面里的FRAME,FRAME里的那个页上的框架,怎么获得呢??
      

  7.   

    LZ。我试着找到了,里面那个框架所在的页面,然后在这个页面里,在抓取FRAME,如果直接从最外层,我就不知道怎么抓了!