| 发表于:2007-04-07 13:22:57 楼主 |
public function urlbodytxt(urlstr as string) as string dim httpobj as new msxml2.xmlhttp50 dim thetimeout as long httpobj.open "get ", urlstr, true httpobj.send thetimeout = gettickcount() do if httpobj.readystate = 4 then if httpobj.status = 200 then urlbodytxt = bytestobstr(httpobj.responsebody, "gb2312 ") else urlbodytxt = " " end if exit do end if if gettickcount() - thetimeout > 6000 then urlbodytxt = " " exit do end if doevents sleep 200 loop set httpobj = nothing end function 我是用来测试是否能在6秒内打开我要打开的地址,由于是循环运行这个过程,只要运行后有一次readystate值达到了4(即成功访问到目标地址)后,那以后再运行到这里时,readystate的值就是一下子就到4了,运行open之前是0,open后是1,只要一运行send,那就直接到4 我在公司的电脑里调试完全没有问题,可回到家里同样是xp系统,为什么就会出现以上的问题 |
|
|
|
|