Spooky this is what i have so far. This gets the downloading done with sucess in 1024 byte chuncks. But the only thing i cant figure out how to use is the
test=call dll(1,"HttpQueryInfoA",url,HTTP_QUERY_CONTENT_LENGTH,fsize,ffsize,0)
DLFile("http://dataphone.games.tucows.com/files/","FishTycoonSetup.exe")
Wait Key
Function DLFile(Url$,FileName$)
If File Exist(FileName$)=1 then Delete File FileName$
Downloaded=0
load dll "wininet.dll", 1
call dll 1, "InternetAttemptConnect", 0
con = call dll(1, "InternetCheckConnectionA",URL$, 1)
if con = 0
print "Internet connection not found!"
end
endif
make memblock 1,1024
buffer = get memblock ptr(1)
size = make memory(4)
make memblock 2,4096
fsize = get memblock ptr(2)
inet = call dll(1, "InternetOpenA", "media", 0, "", "", 0)
url = call dll(1, "InternetOpenUrlA", inet,URL$+FileName$, "", 0, 0, 0)
test = call dll(1, "HttpQueryInfoA",url,HTTP_QUERY_CONTENT_LENGTH,fsize,ffsize,0)
open to write 1,FileName$
Repeat
call dll 1, "InternetReadFile", url, buffer,1024, size
s=*size
for i = 0 to s - 1
write byte 1, memblock byte(1, i)
next i
CLS
print "Downloading: "+FileName$
If test=1 then print "File size : "+str$(*ffsize)+" bytes"
Inc Downloaded,1024
print "Downloaded : "+Str$(Downloaded)+" bytes"
Until s=0
call dll 1, "InternetCloseHandle", url
close file 1
call dll 1, "InternetCloseHandle", inet
delete memory size
delete memblock 1
delete dll 1
EndFunction