webbrowser太慢、inet经常只能获取部分代码,xmlhttp假死
好像都不太完美,Socket可以获取代码吗?怎么些呢?

解决方案 »

  1.   

    sock是发http头去获得 但是要分几次去接,才能完成其实要看什么情况 比如xmlhttp就只是获得静态,如果带ajax的就要用webbbrowers去做了inet什么情况取得部分?我很少用这个,但是一般用得还不错
    个人比较喜欢用xmlhttp和webbrowers
      

  2.   

    找到了一个不假死的xmlhttp   代码如下:
    Public Function GetCode(CodeBase, Url) '第一个参数是设置编码方式(GB2312或UTF-8)第二个参数是地址. 
    Dim xmlHTTP1 
    Set xmlHTTP1 = CreateObject("Microsoft.XMLHTTP") 
    xmlHTTP1.Open "get", Url, True 
    xmlHTTP1.send 
    While xmlHTTP1.ReadyState <> 4 
    DoEvents 
    Wend 
    GetCode = xmlHTTP1.ResponseBody 
    If CStr(GetCode) <> "" Then GetCode = BytesToBstr(GetCode, CodeBase) 
    Set ObjXML = Nothing 
    End Function 
      
    Public Function BytesToBstr(strBody, CodeBase) 
    Dim ObjStream 
    Set ObjStream = CreateObject("Adodb.Stream") 
    With ObjStream 
    .Type = 1 
    .Mode = 3 
    .Open 
    .write strBody 
    .Position = 0 
    .Type = 2 
    .Charset = CodeBase 
    BytesToBstr = .ReadText 
    .Close 
    End With 
    Set ObjStream = Nothing 
    End Function转自:http://topic.csdn.net/u/20080506/17/471bf363-8a2b-428b-889f-75f87b13cc8e.html