怎么样通过PB使用WININET的FTP方式自动更新?

怎么样通过PB使用WININET的FTP方式自动更新?

一些结构和API在非FTP方式文档中有了定义就不再说明。
一、API声明
function uLong InternetOpenA(string lpszAgent, ulong dwAccessType,string lpszProxyName,string lpszProxyBypass, ulong dwFlags) library "wininet.dll"
function ulong InternetConnectA(ulong hInternet,string lpszServerName,ulong nServerPort,string lpszUsername,string lpszPassword,ulong dwService,ulong dwFlags,ulong dwContext) library "wininet.dll"
function boolean InternetCloseHandle(ulong hInternet) library "wininet.dll"
function boolean FtpSetCurrentDirectoryA(ulong hConnect,string lpszDirectory) library "wininet.dll"
function ulong FtpFindFirstFileA(ulong hConnect,string lpszSearchFile,ref s_WIN32_FIND_DATA lpFindFileData,ulong dwFlags,ulong dwContext) library "wininet.dll"
function boolean InternetFindNextFileA(ulong hFind,ref s_WIN32_FIND_DATA lpvFindData) library "wininet.dll"
function boolean FtpGetFileA(ulong hConnect, string lpszRemoteFile,string lpszNewFile,boolean fFailIfExists,ulong dwFlagsAndAttributes,ulong dwFlags,ulong dwContext) library "wininet.dll"
二、全局变量
string gs_application_name
STRING GS_FTPSERVER1
STRING GS_FTPSERVER2
STRING GS_FTPSERVER3
STRING GS_FTPLOGINUSER1
STRING GS_FTPLOGINUSER2
STRING GS_FTPLOGINUSER3
STRING GS_FTPLOGINPASS1
STRING GS_FTPLOGINPASS2
STRING GS_FTPLOGINPASS3
STRING GS_FTPLOGINPORT1
STRING GS_FTPLOGINPORT2
STRING GS_FTPLOGINPORT3
LONG GL_FTPLOGINPORT1
LONG GL_FTPLOGINPORT2
LONG GL_FTPLOGINPORT3
STRING GS_FTPDIR1
STRING GS_FTPDIR2
STRING GS_FTPDIR3

GS_FTPSERVER1 = ProfileString("autodown.ini","downpath","FTPSERVER1","")
GS_FTPSERVER2 = ProfileString("autodown.ini","downpath","FTPSERVER2","")
GS_FTPSERVER3 = ProfileString("autodown.ini","downpath","FTPSERVER3","")
GS_FTPLOGINUSER1 = ProfileString("autodown.ini","downpath","FTPLOGINUSER1","")
GS_FTPLOGINUSER2 = ProfileString("autodown.ini","downpath","FTPLOGINUSER2","")
GS_FTPLOGINUSER3 = ProfileString("autodown.ini","downpath","FTPLOGINUSER3","")
GS_FTPLOGINPASS1 = ProfileString("autodown.ini","downpath","FTPLOGINPASS1","")
GS_FTPLOGINPASS2 = ProfileString("autodown.ini","downpath","FTPLOGINPASS2","")
GS_FTPLOGINPASS3 = ProfileString("autodown.ini","downpath","FTPLOGINPASS3","")
GS_FTPLOGINPORT1 = ProfileString("autodown.ini","downpath","FTPLOGINPORT1","")
GS_FTPLOGINPORT2 = ProfileString("autodown.ini","downpath","FTPLOGINPORT2","")
GS_FTPLOGINPORT3 = ProfileString("autodown.ini","downpath","FTPLOGINPORT3","")
GS_FTPDIR1 = ProfileString("autodown.ini","downpath","FTPDIR1","")
GS_FTPDIR2 = ProfileString("autodown.ini","downpath","FTPDIR2","")
GS_FTPDIR3 = ProfileString("autodown.ini","downpath","FTPDIR3","")