Callback *bug* or is me?
Posted: Wed Oct 22, 2003 7:44 pm
When it trys to set the call back procedure it always returns 0, failure.
AFAIK, I've done what is needed acording to the MSDN
AFAIK, I've done what is needed acording to the MSDN
Code: Select all
;- Roughton Design --- Source Header --------------------------------------------------------------
;
; Author:
; Purpose:
; Filename:
;
;--------------------------------------------------------------------------------------------------
;->
#INTERNET_SERVICE_FTP=1
#INTERNET_OPEN_TYPE_DIRECT=1
#FTP_TRANSFER_ASCII=1
#FTP_TRANSFER_BINARY=2
;->
Structure FTP
server.s
username.s
password.s
remotefile.s
localfile.s
port.l
proxyname.s
proxybypass.s
EndStructure
Global sessionftp.FTP
;--------------------------------------------------------------------------------------------------
;
;--------------------------------------------------------------------------------------------------
Procedure InternetStatusCallback(hInternet.l,Context.l,InternetStatus.l,StatusInformation.l,StatusInformationLength.l)
Debug("!")
EndProcedure
;--------------------------------------------------------------------------------------------------
;
;--------------------------------------------------------------------------------------------------
Procedure FTPGetFile()
proxyname.s=sessionftp\proxyname
proxybypass.s=sessionftp\proxybypass
server.s=sessionftp\server
port=sessionftp\port
username.s=sessionftp\username
password.s=sessionftp\password
remotefile.s=sessionftp\remotefile
localfile.s=sessionftp\localfile
hInternet=InternetOpen_("FTP",#INTERNET_OPEN_TYPE_DIRECT,proxyname,proxybypass,0)
If(hInternet<>0)
hCallback=InternetSetStatusCallback_(hInternet,@InternetStatusCallback())
If(hCallback<>0)
hConnect=InternetConnect_(hInternet,server,port,username,password,#INTERNET_SERVICE_FTP,0,0)
If(hConnect<>0)
If(FtpGetFile_(hConnect,remotefile,localfile,#FALSE,#FILE_SHARE_WRITE,#FTP_TRANSFER_BINARY,0)=#FALSE)
Debug("Error Obtaining File!")
Else
Debug("Success!")
EndIf
Else
EndIf
Else
Debug("Callback Failed!")
EndIf
EndIf
If hConnect : InternetCloseHandle_(hConnect) : EndIf
If hInternet : InternetCloseHandle_(hInternet) : EndIf
EndProcedure
;--------------------------------------------------------------------------------------------------
;
;--------------------------------------------------------------------------------------------------
sessionftp\server="ftp.jetstreamgames.co.nz"
sessionftp\username="anonymous"
sessionftp\password="1@2.3"
sessionftp\remotefile="/pub/ut/maps/ctf-2fortsinhell.zip"
sessionftp\localfile="ctf-2fortsinhell.zip"
sessionftp\port=21
sessionftp\proxyname=""
sessionftp\proxybypass=""
FTPGetFile()