时间: 2021-07-31 作者:daque
uses wininet procedure tform1.button1click(sender: tobject); var lpentryinfo: pinternetcacheentryinfo; hcachedir: longword (*handle*); dwentrysize, dwlasterror: longword; begin //get size of first entry in dwentrysize dwentrysize := 0; findfirsturlcacheentry(nil, tinternetcacheentryinfo(nil^), dwentrysize); //create structure that can hold entry getmem(lpentryinfo, dwentrysize); //get first cache entry and handle to retrieve next entry, output url hcachedir := findfirsturlcacheentry(nil, lpentryinfo^, dwentrysize); if hcachedir <> 0 then memo1.lines.add(string(lpentryinfo^.lpszsourceurlname)); //use this line to delete {deleteurlcacheentry(lpentryinfo^.lpszsourceurlname);} //free structure freemem(lpentryinfo); //retrieve all subsequent entries repeat dwentrysize := 0; findnexturlcacheentry(hcachedir, tinternetcacheentryinfo(nil^), dwentrysize); dwlasterror := getlasterror(); if getlasterror = error_insufficient_buffer then begin getmem(lpentryinfo, dwentrysize); if findnexturlcacheentry(hcachedir, lpentryinfo^, dwentrysize) then memo1.lines.add(string(lpentryinfo^.lpszsourceurlname)); freemem(lpentryinfo); end; until dwlasterror = error_no_more_items; end;