Link to home
Start Free TrialLog in
Avatar of us111
us111Flag for Luxembourg

asked on

How to write a ftp exe in VB6 ?

I try to make an exe which download or put a file.
Could you help me.
I cannot set an inet object.
Must I include some reference or composant?

thx
Avatar of us111
us111
Flag of Luxembourg image

ASKER

Edited text of question
Avatar of us111

ASKER

No comment
ASKER CERTIFIED SOLUTION
Avatar of Mirkwood
Mirkwood

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Mirkwood
Mirkwood

FILE: VBFTP.EXE: Implementing FTP Using WinInet API from VB

Last reviewed: October 24, 1997
Article ID: Q175179 The information in this article applies to:

Microsoft Visual Basic Professional and Enterprise Editions for Windows, versions 4.0, 5.0







SUMMARY

VBFTP.EXE is a sample that implements FTP connection, download, and upload using the WinInet FTP API from Visual Basic. It demonstrates the APIs and techniques to set FTP connection attributes and transfer mode that are not exposed inthe MS Internet Transfer Control.

The sample requires Visual Basic SP2 or Visual Studio SP2 installed to run because it uses the updated comctl32.ocx from those Service Packs.

When adding FTP functionality to your application, it is important to understand the capability and limitation of each of the different Internet technologies. At the lowest level, you could use the Microsoft Winsock Control to send commands directly to FTP server port 21. The sequence and syntax of the commands you send to the server would have to follow the specification of the FTP protocol. The WinInet FTP API wraps the socket code and most low-level FTP commands and provides a set of much simpler task-oriented APIs that do not require detailed knowledge of FTP protocol. However, there is a chance that some FTP servers use FTP commands not implemented by WinInet. If this happens, you have to use the Microsoft Winsock Control to communicate with the server directly at the protocol level. Test your FTP server with the VBFTPJR sample before you decide whether to choose WinInet API or the Winsock Control. The Microsoft Internet Transfer Control, on the other hand, offers a more simplified interface than WinInet but offers less flexibility and cannot be used if you want to customize the connection and transfer mode.

If you are using a proxy to access an FTP server, the proxy has to be capable of handling FTP commands and cannot be a CERN proxy. Please see the following article in the Microsoft Knowledge Base for more information:



   ARTICLE-ID: Q166961
   TITLE     : HOWTO: FTP with CERN-Based Proxy Using WinInet API




The following file is available for download from the Microsoft Software Library:



 ~ vbftp.exe (size: 47597 bytes)




For more information about downloading files from the Microsoft Software Library, please see the following article in the Microsoft Knowledge Base:



   ARTICLE-ID: Q119591
   TITLE     : How to Obtain Microsoft Support Files from Online Services

Avatar of us111

ASKER

ok, it looks good but there's no sub main in the program.
I don't want any forms.
Just funstions and sub main.

How can do this?
Sure make the form invisible 'visible = false'
load form
Now call from sub main the functions you need.
The functions are public functions of the form since they need the inet control
Avatar of us111

ASKER

It doesn't work,
at Inet1.URL = txtURL I have this error : run time error 424 : object required
Sub main can only call public functions of the form.
When sub main wants to communicate to the inet control directly it should do it like "form1.inet1.url = txturl"
Note: there should be an inet control instance on the form. This one is called inet1 by default


Hey, thats my code.
Previously used to answer a simular question on EE months ago.

I you are interested,
I have updated this code. (Soon to be Published)

Avatar of us111

ASKER

OK seems to work.
But as there's no active form, when I execute the exe. I have an error : like
application still executing. How can I avoid or stop this error ?