Information générale
Catégorie:
Fonctions Windows API
Titre:
Adding InternetReadFile to your FTP class.
Robert,
I am attempting to add InternetReadFile() to your ftp class so that I can add a progress bar when downloading files per KB article Q234913 “How To: Provide Download/Upload Progress Information when Using WinInet”
I keep getting the error 1230 – Too Many Arguments, however, when I try to run the InternetReadFile() function and I was wondering if you could take a look at my code and tell me if you see what I might be doing wrong.
I see that you have already declared FtpOpenFile in your ftp.prg but I needed to declare InternetReadFile which I did as:
DECLARE Integer InternetReadFile IN WinInet ;
Integer nConnect_Handle, String @lcReadBuffer, ;
Integer lnBytesToRead, Interger @lnBytesRead
In the calling program I have the following code (minus all of the IF..ENDIF etc. error trapping and all other code not pertinent to the problem.)
SET PROCEDURE TO ftp.prg ADDITIVE
PUBLIC oFTP_Class
oFTP_Class = CREATEOBJECT('ftp_service')
oFTP_Class.OpenInternet("anonymous", "BMW_user", "hardin-soft.com", "21")
oFTP_Class.ChangeFtpDirectory("pub/bulk/updates")
oFTP_Class.OpenFtpConnection()
lcSourceFile = ‘update47.exe’
lnFileHandle = FtpOpenFile( ;
oFTP_Class.nConnect_Handle, ;
lcSourceFile, ;
GENERIC_READ, ;
INTERNET_FLAG_RELOAD + FTP_TRANSFER_TYPE_BINARY, ;
0)
lnPktSize = 4096
lcReadBuffer = SPACE(lnPktSize)
lnBytesRead = 0
lnReadOK = InternetReadFile(lnFileHandle, lcReadBuffer, lnPktSize, @lnBytesRead)
At this point InternetReadFile() bombs everytime with error 1230. I originally had InternetReadFile in a ReadInternetFile() function in the ftp class but decided to run the WinInet function directly from the calling program to simplify debugging while I worked on this problem.
Any help would be greatly appreciated.
Ed
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement