Das mit den Parametern hab ich zwar nicht sehr schlau gelöst, mir ist aber keine bessere Lösung eingefallen.
Code: Alles auswählen
Procedure DownloadUrltoMem(*inURLoutBuffer.LONG,*Len.LONG)
Protected Buffer, offset, hOpen, hFile, ret
#INTERNET_OPEN_TYPE_DIRECT = 1
#INTERNET_FLAG_RELOAD = $80000000
offset = 0
Buffer = AllocateMemory(1)
If Buffer
hOpen = InternetOpen_("", #INTERNET_OPEN_TYPE_DIRECT, "", "", 0)
If hOpen
hFile = InternetOpenUrl_(hOpen, PeekS(*inURLoutBuffer\l,*Len\l), "", 0, #INTERNET_FLAG_RELOAD, 0)
If hFile
Repeat
InternetQueryDataAvailable_(hFile,@tlen,0,0)
Buffer = ReAllocateMemory(Buffer,offset+tlen)
InternetReadFile_(hFile, Buffer+offset, tlen, @ret)
If ret > 0
offset + tlen
EndIf
Until ret = 0
InternetCloseHandle_(hFile)
Else
InternetCloseHandle_(hOpen)
FreeMemory(Buffer)
ProcedureReturn #False
EndIf
InternetCloseHandle_(hOpen)
Else
FreeMemory(Buffer)
ProcedureReturn #False
EndIf
Else
ProcedureReturn #False
EndIf
*inURLoutBuffer\l = Buffer
*Len\l = offset
ProcedureReturn #True
EndProcedure
Url.s = "http://www.robsite.de/"
inURLoutBuffer = @Url
len = Len(Url)
If DownloadUrltoMem(@inURLoutBuffer,@len)
MessageRequester("",PeekS(inURLoutBuffer,len))
FreeMemory(inURLoutBuffer)
EndIf