Probleme connexion FTP en VB6
G_besoinded
-
INFOPR -
INFOPR -
Bonjour à tous,
J'ai un petit problème : j'essaie de réaliser une application en VB6 permettant de faire un download via FTP. Je suis tombé sur un code très courant sur le net, mais surouttrès facile à comprendre. Il utilise la dll "wininet.dll" :
Le problème, c'est qu'il ne fonctionne pas !! Pour être plus précis, la fonction InternetConnect me retourne 0 (ce qui signifie appremment "échec de l'appel de la fonction").
Faut-il être réellement connecté à Internet, ou un réseau local suffit (je suis dans le deuxième cas) ?
Quelqu'un pourrait-il m'aider svp ?
Merci d'avance.
J'ai un petit problème : j'essaie de réaliser une application en VB6 permettant de faire un download via FTP. Je suis tombé sur un code très courant sur le net, mais surouttrès facile à comprendre. Il utilise la dll "wininet.dll" :
Option Explicit Public Declare Function InternetOpen Lib "wininet.dll" Alias "InternetOpenA" _ (ByVal sAgent As String, ByVal lAccessType As Long, ByVal sProxyName As String, _ ByVal sProxyBypass As String, ByVal lFlags As Long) As Long Public Declare Function InternetConnect Lib "wininet.dll" Alias "InternetConnectA" _ (ByVal hInternetSession As Long, ByVal sServerName As String, _ ByVal nServerPort As String, ByVal sUserName As String, _ ByVal sPassword As String, ByVal lService As Long, ByVal lFlags As Long, _ ByVal lContext As Long) As Long Public Declare Function FtpGetFile Lib "wininet.dll" Alias "FtpGetFileA" _ (ByVal hFtpSession As Long, ByVal lpszRemoteFile As String, _ ByVal lpszNewFile As String, ByVal fFailIfExists As Boolean, _ ByVal dwFlagsAndAttributes As Long, ByVal dwflags As Long, _ ByVal dwContext As Long) As Boolean Public Declare Function InternetCloseHandle Lib "wininet.dll" (ByVal hInet As Long) As Integer Sub Download() Dim lngINet As Long Dim lngINetConn As Long Dim blnRC As Boolean 'ouverture session lngINet = InternetOpen("MyFTPControl", 1, vbNullString, vbNullString, 0) 'nom_session, acces direct (no proxy), nom proxy, bypass proxy, lFlags 'etablissement connexion lngINetConn = InternetConnect(lngINet, "10.20.1.1", 0, "essai", vbNullString, 1, 0, 0) 'session, hote a contacter, port 21, login, password, type FTP, lFlags, lContext 'download blnRC = FtpGetFile(lngINetConn, "test.rtf", "c:\resultat.rtf", 0, 0, 1, 0) 'connexion, fichier source, fichier destination, overwrite, lFlags, type ASCII, lContext If lngINetConn <> 0 Then InternetCloseHandle (lngINetConn) If lngINet <> 0 Then InternetCloseHandle (lngINet) End Sub
Le problème, c'est qu'il ne fonctionne pas !! Pour être plus précis, la fonction InternetConnect me retourne 0 (ce qui signifie appremment "échec de l'appel de la fonction").
Faut-il être réellement connecté à Internet, ou un réseau local suffit (je suis dans le deuxième cas) ?
Quelqu'un pourrait-il m'aider svp ?
Merci d'avance.
A voir également:
- Probleme connexion FTP en VB6
- Gmail connexion - Guide
- Vb6 - Télécharger - Divers Utilitaires
- Connexion chromecast - Guide
- Gmail connexion autre compte - Guide
- D'où peut venir un problème de connexion internet sur un ordinateur ? - Guide
j'essais d'utiliser ce script, mais je n'est pas de connexion:
la valeur d lnginet = 13369348
et la valeur de lnginetconn = 0
merci de m'aider : votre script est simple à écrire
de plus MyFTP control ?????
a bientôt : INFOPR