设为首页收藏本站Access中国

Office中国论坛/Access中国论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

返回列表 发新帖
查看: 1976|回复: 1
打印 上一主题 下一主题

[其它] ACCESS实现FTP功能

[复制链接]
跳转到指定楼层
1#
发表于 2006-11-28 07:41:00 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
声明:

Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" _
    (ByVal lpClassName As String, ByVal lpWindowName 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 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 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

Private 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      Private Declare Function InternetCloseHandle Lib "wininet.dll" (ByVal hInet As Long) As Integer

函数

Private Function UpLoadFile(ByVal LocateFile As String, ByVal RemoteFile As String) As Boolean Dim lngINet As Long, lngINetConn As Long, blnRC As Boolean     lngINet = InternetOpen("FTP", 1, vbNullString, vbNullString, 0)     If lngINet = 0 Then Exit Function     lngINetConn = InternetConnect(lngINet, "IP address", port, "user", "password", 1, 0, 0)     If lngINetConn = 0 Then Exit Function     blnRC = FtpPutFile(lngINetConn, LocateFile, RemoteFile, 1, 0)     If blnRC = False Then Exit Function     InternetCloseHandle lngINetConn     InternetCloseHandle lngINet     UpLoadFile = True End Function Private Function DownLoadFile(ByVal RemoteFile As String, ByVal LocateFile As String) As Boolean Dim lngINet As Long, lngINetConn As Long, blnRC As Boolean     lngINet = InternetOpen("FTP", 1, vbNullString, vbNullString, 0)     If lngINet = 0 Then Exit Function     lngINetConn = InternetConnect(lngINet, "IP addresss", port, "user", "password", 1, 0, 0)     If lngINetConn = 0 Then Exit Function     blnRC = FtpGetFile(lngINetConn, RemoteFile, LocateFile, False, 0, 1, 0)     If blnRC = False Then Exit Function     InternetCloseHandle lngINetConn     InternetCloseHandle lngINet     DownLoadFile = True End Function
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享分享 分享淘帖 订阅订阅
2#
发表于 2018-9-28 12:50:19 | 只看该作者
怎么用啊?能否给个示例?
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|站长邮箱|小黑屋|手机版|Office中国/Access中国 ( 粤ICP备10043721号-1 )  

GMT+8, 2024-11-1 11:28 , Processed in 0.077764 second(s), 25 queries .

Powered by Discuz! X3.3

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表