| 发表于:2007-06-30 02:11:113楼 得分:0 |
下载这个dll: http://www.m5home.com/soft/downurl.dll 然后在vb里面新建一个模块,放以下代码: option explicit public declare function downloadfile lib "downurl.dll " (byval fileurl as string, byval savefilename as string, byval funcaddr as long) as long public declare sub abortalldownload lib "downurl.dll " () private declare function lstrcpy lib "kernel32.dll " alias "lstrcpya " (byval lpstring1 as string, byval lpstring2 as long) as long public function dllcallback(byval fileurl as long, byval fileurllength as long, byval savefilename as long, _ byval savefilenamelength as long, byval totalbyte as long, byval nowreadbyte as long) as boolean dim i as string, j as string, k as long if fileurllength > 0 then i = space(fileurllength) lstrcpy i, byval fileurl end if if savefilenamelength > 0 then j = space(savefilenamelength) lstrcpy j, byval savefilename end if debug.print i & "/ " & j & "/ " & totalbyte & "/ " & nowreadbyte dllcallback = true end function 调用: call downloadfile( "http://xxx/index.htm ", "d:\index.htm ", addressof dllcallback) 这个就是直接下载到文件的,调用后是立即返回,在后台以一个单独线程下载. 可以多次调用,这样可以同时下载n多文件. 初学汇编的作品,进度显示还有点问题,hoho.....:) | | |
|