当前位置:首页 > 网络编程 > 软件语言 > DELPHI > 删除internet临时文件

删除internet临时文件

点击次数:46 次 发布日期:2008-11-09 08:40:43 作者:源代码网
源代码网推荐
广告载入中
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;


源代码网推荐

源代码网供稿.
网友评论 (0)
会员中心
网络编程
本站推荐
网络编程之精华