国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 開發 > 綜合 > 正文

用vb實現ftp的上傳下載

2024-07-21 02:20:36
字體:
來源:轉載
供稿:網友


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) as integer

public declare function ftpfindfirstfile lib "wininet.dll" alias "ftpfindfirstfilea" _
(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 "wininet.dll" alias "internetfindnextfilea" _
(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
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 "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 string
end type
private sub command1_click()
lnginet = internetopen(vbnullstring, internet_open_type_preconfig, _
vbnullstring, vbnullstring, 0&)
if lnginet then
lnginetconn = internetconnect(lnginet, "ip地址", 0, _
"用戶名", "密碼", 1, 0, 0)
if lnginetconn then
blnrc = ftpgetfile(lnginetconn, "website/address.asp", "c:/address.asp", 0, 0, 1, 0)
if blnrc then
msgbox "download ok!!!"
end if
internetclosehandle lnginetconn
internetclosehandle lnginet
msgbox "close ok!!!"
else
msgbox "can't connect"
end if
else
msgbox "ftp wrong"
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, "ip地址", 0, _
"用戶名", "密碼", 1, 0, 0)
if lnginetconn then
lnghinet = ftpfindfirstfile(lnginetconn, "*.*", pdata, 0, 0)
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



發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 赤水市| 长沙县| 图木舒克市| 韶关市| 南城县| 清流县| 南康市| 太湖县| 石门县| 蛟河市| 巴林右旗| 肇庆市| 科技| 祁门县| 得荣县| 巩留县| 高邮市| 林州市| 岑溪市| 罗城| 游戏| 云浮市| 秭归县| 湘潭市| 苏尼特左旗| 陇川县| 崇阳县| 当阳市| 中超| 栖霞市| 疏附县| 道孚县| 瑞安市| 郸城县| 崇信县| 赤峰市| 阿鲁科尔沁旗| 滨州市| 九寨沟县| 镇原县| 濉溪县|