Hi,
ich nutze diese Funktion um mir eine Datei aus dem Web in einen Stream zu lesen und durch den Inhalt der Datei festzustellen ob es ein update der software gibt. Obwohl ich die Datei in einen Stream lade scheint er diese aus dem Cache und nicht wie festgelegt aus dem Web zu laden. Wie kann ich es verhindern das die Datei aus dem Cache geladen wird ? weil ich das auch als grundroutine für einige webseitenanalysefunktionen nutze wäre es generell sinnig das der cache nicht genutzt wird. Ich hoffe Ihr könnt helfen.
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54:
| function UrlDownloadToStream(URL: String; Stream: TStream): Boolean; var ppStream: IStream; statstg: TStatStg; lpBuffer: Pointer; dwRead: Integer; begin result:=False;
if Assigned(Stream) then begin if (URLOpenBlockingStream(nil, PChar(URL), IStream(ppStream), 0, nil) = S_OK) then begin try if (ppStream.Stat(statstg, STATFLAG_NONAME) = S_OK) then begin if (statstg.cbSize > 0) then begin lpBuffer:=AllocMem(statstg.cbSize); try if (ppStream.Read(lpBuffer, statstg.cbSize, @dwRead) = S_OK) then begin Stream.Write(lpBuffer^, dwRead); try Stream.Seek(-dwRead, soFromCurrent); finally result:=True; end; end; finally FreeMem(lpBuffer); end; end; end; finally ppStream:=nil; end; end; end; end; |