国产探花免费观看_亚洲丰满少妇自慰呻吟_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



發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 英德市| 扎囊县| 清水河县| 衡南县| 龙泉市| 江西省| 民勤县| 西藏| 甘肃省| 盐亭县| 双鸭山市| 东宁县| 万山特区| 宁乡县| 齐齐哈尔市| 安国市| 青龙| 睢宁县| 康乐县| 阿鲁科尔沁旗| 广昌县| 尚义县| 建阳市| 荥阳市| 高要市| 武隆县| 威信县| 沈丘县| 贺兰县| 灵武市| 利津县| 阜康市| 叙永县| 安徽省| 嘉定区| 海门市| 温州市| 益阳市| 泸溪县| 大新县| 松滋市|