用vb实现ftp的上传下载
更新时间:2023-10-28 05:25:02 阅读量: 综合文库 文档下载
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
Public Declare Function FtpRenameFile Lib \
(ByVal hFtpSession As Long, ByVal lpszExsiting As String, ByVal lpszNew As String) As Boolean
Public Declare Function InternetCloseHandle Lib \
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 \(ByVal hFind As Long, lpvFndData As WIN32_FIND_DATA) As Long
Const INTERNET_OPEN_TYPE_PRECONFIG = 0
Public Type FILETIME
dwLowDateTime As Long
dwHighDateTime As Long End Type
Public Type WIN32_FIND_DATA dwFilAttributes As Long
ftCreationTime As FILETIME 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 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 String End Type
Private Sub Command1_Click()
lnginet = InternetOpen(vbNullString, INTERNET_OPEN_TYPE_PRECONFIG, _ vbNullString, vbNullString, 0&)
If lnginet Then
lnginetconn = InternetConnect(lnginet, \地址\ \用户名\密码\ If lnginetconn Then
blnRC = FtpGetFile(lnginetconn, \ If blnRC Then
MsgBox \ End If
InternetCloseHandle lnginetconn InternetCloseHandle lnginet MsgBox \ Else
MsgBox \ End If Else
MsgBox \End If End Sub
Private Sub Command2_Click() Dim pData As WIN32_FIND_DATA Dim lngHINet As Long Dim intError As Integer Dim strTemp As String Dim blnRC As Boolean
pData.cFileName = String(260, 0)
lnginet = InternetOpen(vbNullString, INTERNET_OPEN_TYPE_PRECONFIG, _ vbNullString, vbNullString, 0&) If lnginet Then
lnginetconn = InternetConnect(lnginet, \地址\ \用户名\密码\ If lnginetconn Then
lngHINet = FtpFindFirstFile(lnginetconn, \
strTemp = Left(pData.cFileName, InStr(1, pData.cFileName, String(1, 0), vbBinaryCompare) - 1) Do
pData.cFileName = String(260, 0)
blnRC = InternetFindNextFile(lngHINet, pData) If Not blnRC Then Exit Do Else
strTemp = Left(pData.cFileName, InStr(1, pData.cFileName, String(1, 0), vbBinaryCompare) - 1) End If
Loop
Text1.Text = strTemp End If End If
InternetCloseHandle lngHINet
InternetCloseHandle lnginetconn InternetCloseHandle lnginet End Sub
正在阅读:
用vb实现ftp的上传下载10-28
舜浦大酒店地下结构施工组织设计11-22
如何激发小学低年级学生的识字兴趣03-12
小学生家庭教育之我见05-10
十、爆炸焊接01-10
2014春外国银行制度与业务作业(大题)07-04
重庆八中2012 - 2013学年度(上)期末考试高二年级11-26
行政管理学-在线练习201-14
2015年4月江苏省高等教育自学考试10052职业生涯规划与管理12-06
大学物理(下)试题库分解03-08
- 多层物业服务方案
- (审判实务)习惯法与少数民族地区民间纠纷解决问题(孙 潋)
- 人教版新课标六年级下册语文全册教案
- 词语打卡
- photoshop实习报告
- 钢结构设计原理综合测试2
- 2014年期末练习题
- 高中数学中的逆向思维解题方法探讨
- 名师原创 全国通用2014-2015学年高二寒假作业 政治(一)Word版
- 北航《建筑结构检测鉴定与加固》在线作业三
- XX县卫生监督所工程建设项目可行性研究报告
- 小学四年级观察作文经典评语
- 浅谈110KV变电站电气一次设计-程泉焱(1)
- 安全员考试题库
- 国家电网公司变电运维管理规定(试行)
- 义务教育课程标准稿征求意见提纲
- 教学秘书面试技巧
- 钢结构工程施工组织设计
- 水利工程概论论文
- 09届九年级数学第四次模拟试卷
- 上传下载
- 实现
- ftp
- 企业内部控制制度浅析
- 五四表彰大会暨校园十大歌手大赛 策划书
- AM真菌在生态系统中的作用
- 浅论如何当好监狱基层纪检委员
- Bresenham画圆算法
- 电力系统自动装置实验报告 - 图文
- 数据通信与计算机网络 - 复习题总 - 图文
- 初中课堂教学改革实施方案(讨论稿)
- 自然辩证法概论课件(word版)
- 西方经济学(微观部分)考研真题与典型题详解—7
- 物业服务小区共用设备设施养护情况专项检查表(2014年8月15日)
- 小学数学青岛版二年级下册周周练习 - 图文
- 电大成人教育本科《计算机应用基础》
- 4B 词汇表新
- 论述广告摄影中大型相机移轴与透视效果的运用 - 图文
- 中考数学复习动点问题中考真题 答案
- 2015年N1N2级护士年终三基理论考试答案
- 北京市农村建房用地管理暂行办法
- 高层建筑结构试题题目 - 图文
- 1比1万数字高程模型生产技术规定