General information
Category:
Windows API functions
I've built a class for transferring files by FTP. It works fine before I installed Visual Studio SP5. The problem only occuried in GET operation.
I'm using NT 4.0 with SP6. Visual Foxpro 6.0 with SP5.
The wininet.dll version is 5.50.4134.600.
Thank you for your help in advance.
Here's the code
***************
* functions
#define INTERNET_FLAG_RELOAD 0x80000000
Declare long InternetOpen in "wininet.dll" as FTPopen ;
string sAgent,long lAccessType,string sProxyName, ;
string sProxyBypass,long lFlags
Declare long InternetConnect in "wininet.dll" as FTPconnect ;
long hInternetSession, string sServerName,integer nServerPort, ;
string sUsername,string sPassword,long lService,long lFlags,long lContext
Declare integer FtpGetFile in "wininet.dll" as FTPget ;
long hFtpSession,string sRemoteFile,string sNewFile, ;
integer nFailIfExists, long nFlagsAndAttributes,long nFlags,long nContext
Declare integer FtpPutFile in "wininet.dll" as FTPput ;
long hFtpSession,string sLocalFile,string sRemoteFile, ;
long nFlags,long nContext
Declare integer InternetCloseHandle in "wininet.dll" long hInet
lError = .F.
hOpen = -1
hConnection = -1
sMessage = ''
sUser = 'ftpuser'
sPassword = 'test'
sHostname = 'test'
** open channel
hOpen = FTPopen("vfp wininet", 0, "", "", 0)
IF hOpen <> 0
hConnection = FTPconnect(hOpen,sHostname,0,sUser,sPassword,1, 0, 0)
IF hConnection <> 0
** get
nType = BITOR(1,INTERNET_FLAG_RELOAD)
nReturn = FTPget(hConnection,'/export/test.dat','test.dat', .F., 0x80, nType, 0)
IF nReturn = 0
ELSE
IF FILE('ric.dat')
sMessage = 'File found'
ENDIF
ENDIF
ENDIF
ENDIF
IF hConnection != 0
InternetCloseHandle(hConnection)
ENDIF
IF hOpen != 0
InternetCloseHandle(hOpen)
ENDIF
CLEAR DLLS
*********** END OF CODE ****
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only