现在需要解决的问题是:循环从axWebBrowser控件中读取多个网页中的HTM! 然后AppendText显示在一个richTextBox 中!现在做到的 从axWebBrowser中下载完页面后使用  
private void axWebBrowser1_DocumentComplete(object sender, AxSHDocVw.DWebBrowserEvents2_DocumentCompleteEvent e)

{
if (axWebBrowser1.ReadyState==SHDocVw.tagREADYSTATE.READYSTATE_COMPLETE)
{
mshtml.HTMLDocumentClass doc =(mshtml.HTMLDocumentClass)axWebBrowser1.Document;
string source=doc.body.outerHTML;
yincang1.Text=source;
}
}
显示在yincang1这个richTextBox 中了我是使用的 DocumentComplete 这个东西!  不知道还有其他办法吗?可是如何实现循环  的  显示在里面呢?????

解决方案 »

  1.   

    你是指假定有5个网页要依序开启,并且取得它们的html代码append到richtextbox中,而不是真的要浏览网页?那就用httpwebrequest元件比较快又省资源阿。
      

  2.   

    我知道!可是我要读取的是登陆后才能看到的东西!
    httpwebrequest  好象比较麻烦呀!哈哈!
    我我我。 要好好学习C#
      

  3.   

    string source=doc.body.outerHTML;
    --------------------------------
     1. 这样还不能把html文件的头取出来。 
     2. 一个能取,多个也一样. HRESULT m_hResult;
    IPersistStreamInit* spPSI = NULL;
    CStreamOnCString stream;
    m_hResult = m_pHTMLDoc2->QueryInterface(IID_IPersistStreamInit, (void**)&spPSI);
    if( SUCCEEDED(m_hResult) && spPSI )
    {
    m_hResult = spPSI->Save(static_cast<IStream*>(&stream), TRUE);
    if (m_hResult == S_OK)
    {
    if (!stream.CopyData(str))
    m_hResult = E_OUTOFMEMORY; 
    }
    spPSI->Release();
    }这个是获取html的流。