我的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

解决方案 »

  1.   

    谢谢楼上的MM朋友:)因为我的文件路径名中都含有空格,所以put和get的时候,我把路径引号引起来了
      

  2.   

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

  3.   

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