主题:求救:关于wininet.dll中ftpFindFirstFile函数的问题。
小弟在pb9中调用wininet.dll中的ftpFindFirstFile()函数,能获取到文件,但传给WIN32_FIND_DATA类型的file1变量时,不能获取file.cfilename值,请问是怎么回事呢?请各位大哥指点!
long ll_hret
long ll_hftp
st_2.text = '连接服务器...'
st_2.text = '已成功连接至服务器,正在传输文件'
ll_hret = InternetOpenA('Microsoft Internet Explorer',0,'','',0)
ll_hftp = InternetConnectA(ll_hret,'192.168.0.8',21,'administrator','test',1,0,0
lb_success = FtpSetCurrentDirectoryA(ll_hftp,ls_remote_directory)
if not lb_success then
InternetCloseHandle(ll_hret);
InternetCloseHandle(ll_hftp);
st_2.text = '文件传输失败!'
messagebox('错误!','FTP服务器目录不存在',stopsign!)
return
end IF
s_win32_find_data ss_file1
ulong ll_fftp
ll_fftp = FtpFindFirstFileA(ll_hftp,'*.*',ss_file1,0,0)
if ll_fftp <> 0 then
messagebox(string(ss_file1.dwfileattributes),ss_file1.cfilename)
do while InternetFindnextFileA(ll_fftp, ss_file1)
messagebox(string(ss_file1.dwfileattributes),ss_file1.cfilename)
loop
end if
InternetCloseHandle(ll_hret)
InternetCloseHandle(ll_hftp)
InternetCloseHandle(ll_fftp)
return
s_win32_find_data结构定义如下:
global type s_win32_find_data from structure
unsignedlong dwfileattributes
datetime ftcreationtime
datetime ftlastaccesstime
datetime ftlastwritetime
unsignedlong nfilesizehigh
unsignedlong nfilesizelow
unsignedlong dwreserved0
unsignedlong dwreserved1
string cfilename
string calternatefilename
end type
long ll_hret
long ll_hftp
st_2.text = '连接服务器...'
st_2.text = '已成功连接至服务器,正在传输文件'
ll_hret = InternetOpenA('Microsoft Internet Explorer',0,'','',0)
ll_hftp = InternetConnectA(ll_hret,'192.168.0.8',21,'administrator','test',1,0,0
lb_success = FtpSetCurrentDirectoryA(ll_hftp,ls_remote_directory)
if not lb_success then
InternetCloseHandle(ll_hret);
InternetCloseHandle(ll_hftp);
st_2.text = '文件传输失败!'
messagebox('错误!','FTP服务器目录不存在',stopsign!)
return
end IF
s_win32_find_data ss_file1
ulong ll_fftp
ll_fftp = FtpFindFirstFileA(ll_hftp,'*.*',ss_file1,0,0)
if ll_fftp <> 0 then
messagebox(string(ss_file1.dwfileattributes),ss_file1.cfilename)
do while InternetFindnextFileA(ll_fftp, ss_file1)
messagebox(string(ss_file1.dwfileattributes),ss_file1.cfilename)
loop
end if
InternetCloseHandle(ll_hret)
InternetCloseHandle(ll_hftp)
InternetCloseHandle(ll_fftp)
return
s_win32_find_data结构定义如下:
global type s_win32_find_data from structure
unsignedlong dwfileattributes
datetime ftcreationtime
datetime ftlastaccesstime
datetime ftlastwritetime
unsignedlong nfilesizehigh
unsignedlong nfilesizelow
unsignedlong dwreserved0
unsignedlong dwreserved1
string cfilename
string calternatefilename
end type