На мой взгляд, апи лучший выход.
Модуль
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 Integer, _
ByVal sUserName As String, _
ByVal sPassword As String, _
ByVal nService As Long, _
ByVal dwFlags As Long, _
ByVal dwContext As Long) As Long
Public Const INTERNET_SERVICE_FTP = 1
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 FtpPutFile _
Lib "wininet.dll" Alias "FtpPutFileA" ( _
ByVal hFtpSession As Long, _
ByVal lpszLocalFile As String, _
ByVal lpszRemoteFile As String, _
ByVal dwFlags As Long, _
ByVal dwContext As Long) As Boolean
Public Declare Function InternetCloseHandle _
Lib "wininet.dll" (ByVal hInet As Long) As Integer
Это вызов
hINetSession = InternetOpen("FTP", 1, vbNullString, vbNullString, 0)
hSession = InternetConnect(hINetSession, "ftp.url.ru", "21", "login", _
"pass", INTERNET_SERVICE_FTP, 0, 0)
If FtpPutFile(hSession, "c:\log.txt", "/log.txt", 1, 0) = False Then msgbox "Ошибка"
Call InternetCloseHandle(hSession)
Call InternetCloseHandle(hINetSession)
Всё понял?
На счёт сокетов... может возникнуть ошибка в интернет трансерфе 6.0
Если хочешь использовать именно его, нужно скачать обновлённую MSINET.OCX компоненту.
Ответить
|