基于vb环境WINDOWS API的ftp上传下载服务的实现 下载本文

内容发布更新时间 : 2024/11/9 9:52:30星期一 下面是文章的全部内容请认真阅读。

基于vb的ftp上传下载服务的实现

Option Explicit

Public Declare Function InternetOpen Lib \(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 \_

(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 \ (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 \(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 \ (ByVal hFtpSession As Long, ByVal lpszFileName As String) As Boolean

1

Public Declare Function FtpRenameFile Lib \ (ByVal hFtpSession As Long, ByVal lpszExsiting As String, ByVal lpszNew As String) As Boolean

Public Declare Function InternetCloseHandle Lib \As Integer

Public Declare Function FtpFindFirstFile Lib \ (ByVal hFtpSession As Long, ByVal lpszSearchFile As String, _ lpFindFileData As WIN32_FIND_DATA, ByVal dwFlags As Long, _ ByVal dwContent As Long) As Long Public

Declare

Function

InternetFindNextFile

Lib

\

Alias

\

(ByVal hFind As Long, lpvFndData As WIN32_FIND_DATA) As Long Public Type FILETIME dwLowDateTime As Long dwHighDateTime As Long End Type

Public Type WIN32_FIND_DATA dwFilAttributes As Long ftCreationTime As FILETIME

2

ftLastAccessTime As FILETIME ftLastWriteTime As FILETIME nFileSizeHigh As Long nFileSizeLow As Long dwReserved0 As Long dwReserved1 As Long cFileName As String * 260 cAlternate As String * 14 End Type

Public Declare Function GetOpenFileName Lib \ \

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

3