+ -
当前位置:首页 → 问答吧 → inet下载的问题

inet下载的问题

时间:2010-04-16

来源:互联网

我的ftp服务器就在局域网内。
只下载一个文件,调试的时候,有时候好好的,但是经常cpu占用到了98%,99%,文件一直显示是0字节。请大家帮忙看看是什么原因?我贴代码。

Friend Sub execute(ByVal RemoteFile As String, ByVal LocalFile As String, ByVal FtpCommand As String)
  Dim strIpAddr As String, strUser As String, strPass As String
  strIpAddr = "ftp://192.168.1.210"
  strUser = "ranassa"
  strPass = "871116"
  
  With Inet1
  .Protocol = icFTP
  .RequestTimeout = 60
  .RemotePort = 21
  .AccessType = icDirect
  .URL = strIpAddr
  .UserName = strUser
  .Password = strPass
  End With
   
  Select Case LCase(FtpCommand)
  Case "put"
  Inet1.execute , FtpCommand & " " & Chr(34) & LocalFile & Chr(34) & " " & Chr(34) & RemoteFile & Chr(34)
  Case "get"
  If Dir(LocalFile, vbNormal) <> "" Then Kill LocalFile
  Inet1.execute , FtpCommand & " " & Chr(34) & RemoteFile & Chr(34) & " " & Chr(34) & LocalFile & Chr(34)
  End Select
   
  Do While Inet1.StillExecuting
  DoEvents
  Loop
   
  Inet1.execute , "close"
  Inet1.execute , "quit"
End Sub

作者: ranassa   发布时间: 2010-04-16

等我帮助研究一下

作者: needanothercoder   发布时间: 2010-04-16

谢谢楼上的MM朋友:)

因为我的文件路径名中都含有空格,所以put和get的时候,我把路径引号引起来了

作者: ranassa   发布时间: 2010-04-16

顶上来

作者: ranassa   发布时间: 2010-04-16

用inet不好,经常会卡住,推荐使用bkDLControl来下载文件,这个控件自带进度条的。
去Google一下“bkDLControl”就一大堆,祝你好运

作者: wangsijie   发布时间: 2010-05-08

这几天一直在搞INET,借鉴了一下LZ的代码,居然可以下载了,感谢!!!

作者: WEWE0511   发布时间: 2011-08-11

热门下载

更多