In this project we shall discuss using Microsoft Interner Transfer Control or (INET.Ocx) to :
Connect to FTP remote server.
Retrieving main/sub directories from FTP remote server.
Retrieving files from FTP remote server.
Uploading file to FTP remote server.
Downloading file from FTP remote server.
Make new directory (folder) at FTP remote server.
Rename & Delete file from FTP remote server.
In this project we won't be using API calls (i.e. INET API) also we will cover these issues :
The Spaces problem while downloading and uploading files.
Error message "Still executing last request" number 35764.
Error message "File exists"
Application Hangs up after ending it.
Using TreeView control to list all the Directories on the FTP remote server.
Using ListBox control to list all files on the FTP remote server related to above folder.
The project source code is uploaded to Mediafire.com direct link and no password.
The project exe file tested and debuged uploaded to Mediafire.com direct link and no password.
I will demonstrate a breif explanation now on how does it work and how did i code it to make things easy to follow the logic.
What we have done was :
Specifying valid FTP remote server name, a username and a password if password required in their relevant textboxes on the form then we click on connect, we notice that the TreeView control is filled with main directories while ListBox control is filled with main files root, that required setting up the Treeview first in the Design-Time (IDE) then we did the same to the ListBox control as well to correctly receive data returned from the FTP remote server.
While recieving the data we've changed the cursor shape beside tracking down the ftp server status calls in a label called LblStatus to let the user know that something is going on, and in the end of the proccess we display a hint on what was done after all (i.e. Uploaded Completed Successfully) the message is called (User friendly) coz the user won't need to know that the ftp server data sent status is (i.e. icReceivingResponse).
Everytime we proccess a file or a routine we had to check for the status of the ftp server using the Inet1_StateChanges(Istate As Integer) event, which monitors the changes in the FTP remote server and execute its methods according to our code through relevant changes we decide to use.
The Code blocks are well commented so you won't find it hard to understand a logic we used.
We provided in the source code some icons we used to display in the TreeView control and the ListBox contro too, also note that the ImageList control must be placed on the form before both the TreeView and the ListBox controls in order to be used.
Also make sure that you use the same version (SP6) of the controls (ListBox and TreeView) as we provided both OCX files in the source code folder.
We used the (FSO Library) File System Object and that is why you will find the relevant DLL file (scrrun.dll) included too in the source code folder, we used it to make sure that there is no duplications problems happen while executing codes to FTP server, also it's a way to get the Path & FileName without spaces because it's a big problem when working with Internet elements like Inet FTP that it's not allowed to use spaces in your file names or paths.
Source Code - Mediafire
2 Replies - 10766 Views - Last Post: 14 June 2012 - 03:19 AM
Replies To: Full ftp with visual basic 6.0 without using API calls
Page 1 of 1