FTP upload components

xiaoxiao2021-03-06  38

First, have time to test 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 Integer, 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 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 FtpDeleteFile Lib "wininet.dll" Alias ​​"FtpDeleteFileA" _ (ByVal hFtpSession As Long, ByVal lpszFileName As String) As Boolean Public Declare Function FtpRenameFile Lib "wininet.dll" Alias ​​"FtpRenameFileA" _ (ByVal hFtpSession As Long, ByVal LPSZEXSITING AS STRING, BYVAL LPSZNEW AS STRING AS Boolean Public Declare Function InternetCloseHandle Lib "Wininet.dll" (Byval Hinet As Long)

Declare Function GetOpenFileName Lib "comdlg32.dll" Alias ​​_ "GetOpenFileNameA" (pOpenfilename As OPENFILENAME) As Long Type OPENFILENAME lStructSize As Long hwndOwner As Long hInstance As Long lpstrFilter As String lpstrCustomFilter As String nMaxCustFilter As Long nFilterIndex As Long lpstrFile As String nMaxFile As Long lpstrFileTitle As String nMaxFileTitle As Long lpstrInitialDir As String lpstrTitle As String flags As Long nFileOffset As Integer nFileExtension As Integer lpstrDefExt As String lCustData As Long lpfnHook As Long lpTemplateName As StringEnd TypePrivate Sub Timer1_Timer () lnginet = InternetOpen (vbNullString, INTERNET_OPEN_TYPE_PRECONFIG, _ vbNullString, vbNullString , 0 &) IFINN = InternetConnect (LNGINET, "210.51.180.101", 0, _ "User Name", "Password", 1, 0, 0) IF LNGINETCONN THEN BLNRC = ftpputfile (LNGINETCONN, "Your specific upload Dongdong, "FTP of the website", 0, 0, 1, 0) IF BL Nrc Then Msgbox "Download OK !!!" END IF InternetCloseHandle LNGINETCONN INTERNETCLOSEHANDLE LNGINET ELSE A = 1 Doevents End IFEnd Sub

转载请注明原文地址:https://www.9cbs.com/read-67436.html

New Post(0)