请问有没有比inet控件更快得到网页源文件的方法:dim content as string 
Inet1.url="www.sohu.com"
content = Inet1.OpenURL(Inet1.url)
msgbox content请各位指点
感谢感谢~

解决方案 »

  1.   

    请问有没有比inet控件更快得到网页源文件的方法:dim content as string 
    Inet1.url="www.sohu.com"
    content = Inet1.OpenURL(Inet1.url)
    msgbox content请各位指点
    感谢感谢~
      

  2.   

    试试这个
    加入timer,commandbutton,text
    private sub command1_click()
    webbrowser1.navigate http://www.sohu.com/
    timer1.enabled=true
    end subprivate sub timer1_timer()
    dim doc,objhtml as object
    dim i as integer
    dim strhtml as stringif not webbrowser1.busy then
    set doc=webbrowser1.document
    i=0
    set objhtml=doc.body.createtextrange()
    if not isnull(objhtml) then
    text1.text=objhtml.htmltext
    end if
    timer1.enabled=false
    end if
    end sub
      

  3.   


    我测试过了,的确webbrowser快,可是要立刻得到源代码好像就慢了些
    为什么半天都得不到内容呢?text1.text=objhtml.htmltext
    感谢
      

  4.   

    webbrowser1要加载网页
    将timer1时间调短一些
      

  5.   

    Private Declare Function URLDownloadToFile Lib "urlmon" _
       Alias "URLDownloadToFileA" _
      (ByVal pCaller As Long, _
       ByVal szURL As String, _
       ByVal szFileName As String, _
       ByVal dwReserved As Long, _
       ByVal lpfnCB As Long) As Long
       
    Private Sub Command1_Click()
    URLDownloadToFile 0, "http://office.9zp.com/index.asp", "c:\test.txt", 0, 0
    End Sub
      

  6.   

    其实webbrowser1最慢.它要把所有图片下载完了才行,如果碰到一个图片来自另一个服务器,并且打不开,那你就等着吧!不过它是异步执行的,所以不影响程序的运行.
    其实还有更快的------URLOpenStream(类似URLDownloadToFile)
      

  7.   

    请问URLOpenStream如何使用,能说详细点吗?谢谢!
      

  8.   

    to:   hhjjhjhj(大头)URLDownloadToFile 0, "www.sohu.com", "c:\test.txt", 0, 0程序没报错,但是找不到test.txt文件,为什么??
      

  9.   

    URLDownloadToFile 0, "http://www.sohu.com", "c:\test.txt", 0, 0
    URLOpenStream如何使用-----看API资料或微软MSDN网站
      

  10.   

    不懂不懂,看的有点晕了!!!!Private Declare Function URLOpenStream Lib "urlmon" _
       Alias "URLOpenStreamA" _
      (ByVal pCaller As Long, _
       ByVal szURL As String, _
       ByVal content As String, _
       ByVal dwReserved As Long, _
       ByVal lpfnCB As Long) As Long
       
       
    Private Sub Command1_Click()
    Dim content As Variant
    URLOpenStream 0, "http://www.sohu.com", content, 0, 0
    MsgBox content
    End Sub无法实现!为什么不能直接给content值呢??
      

  11.   

    我看了一段代码是这样的
    IStream * pStream;
    URLOpenStream (NULL, L"http://www.msn.com/", &pStream,
                   0, 0);char buffer[0x100];DWORD dwGot;
    HRESULT hr = NOERROR;do {
        hr = pStream->Read (buffer, sizeof(buffer),&dwGot);    //.. do something with contents of buffer ...
        } while (SUCCEEDED(hr));
    .
    可是明明URLOpenStream没有定义什么数据输出接口呀
    msdn 上是这么定义的HRESULT URLOpenStream(
      LPUNKNOWN pCaller,
      LPCSTR szURL,
      DWORD dwReserved,
      LPBINDSTATUSCALLBACK lpfnCB
    )
    哪位高手能解释解释如何得到内容,难道也要做个地址指针来循环吗?