Hi guys i got the following code for ftp download problem i have is its like the app is frozen for the duration of the download i checked in task manager and pc also thinks its not repsponding this corrects when download finishes. its usually for a second or so on 3 mb files but the bigger the file the longer the freeze pc still works fine all the time this is happening its the app that is non reponsive. i dont understand this code as well as i could and i cant seem to fix it. any help would be great

VB Code:
  1. Private Sub downloadFile_Click()
  2. Dim i As Long
  3.  
  4. On Error Resume Next
  5.            
  6.     For i = 0 To List2.ListCount - 1
  7.    
  8.             'Check if file has been selected
  9.         If List2.Selected(i) = True Then
  10.         Call FtpGetFile(hConnection, sFile.Text, App.Path & "\" & sFile.Text, 0, 0, 2, 0)
  11.         DoEvents
  12.         End If
  13.        
  14.    Next
  15. End Sub
  16.  
  17.  
  18. Sub DownloadFiles(ftp_url As String, username As String, password As String)
  19.    Dim sOrgPath  As String
  20.    
  21.    
  22.     'open an internet connection
  23.     hOpen = InternetOpen("API-Guide sample program", INTERNET_OPEN_TYPE_PRECONFIG, vbNullString, vbNullString, 0)
  24.     'connect to the FTP server
  25.     hConnection = InternetConnect(hOpen, ftp_url, INTERNET_DEFAULT_FTP_PORT, username, password, INTERNET_SERVICE_FTP, IIf(PassiveConnection, INTERNET_FLAG_PASSIVE, 0), 0)
  26.     sOrgPath = String(MAX_PATH, 0)  'create a buffer to store the original directory
  27.     FtpGetCurrentDirectory hConnection, sOrgPath, Len(sOrgPath) 'get the directory
  28.     FtpSetCurrentDirectory hConnection, "/jd/logs/"   'set the current directory to 'root/httpdocs'
  29.     EnumFiles hConnection   'enumerate the file list from the current directory ('root/testing')
  30.  
  31.  
  32.    
  33. End Sub
  34.  
  35.  
  36. Private Sub ftpconnect_Click()
  37. If ftpconnect.Caption = "Connect" Then
  38.     Screen.MousePointer = vbHourglass
  39.     DownloadFiles txtFTP, txtUserName, txtPassword
  40.     Screen.MousePointer = vbDefault
  41.     ftpconnect.Caption = "Disconnect"
  42.  
  43. Else
  44.  
  45. If ftpconnect.Caption = "Disconnect" Then
  46.     InternetCloseHandle hConnection
  47.     InternetCloseHandle hOpen
  48.     List2.Clear
  49.     ftpconnect.Caption = "Connect"
  50.     End If
  51. End If
  52.  
  53. End Sub

thanks in advance