文件名称:Delphi清理Windows临时文件的例子及源码.rar
文件大小:6KB
文件格式:RAR
更新时间:2022-07-30 11:48:25
Delphi源码-系统相关
Delphi清理Windows临时文件的例子及源码,这里的临时文件主要是Internet Explorer上网时产生的垃圾文件,上传源码前测试了一下,Windows7下还真清理成功了。不过清理过程中,窗口会假死一阵子,可能程序忙,不过也折射出程序仍需要优化完善,来看看下边的代码段吧,更多代码请在演示截图下边单击按钮下载。 begin dwEntrySize := 0; FindFirstUrlCacheEntry(nil, TInternetCacheEntryInfo(nil^), dwEntrySize); GetMem(lpEntryInfo, dwEntrySize); hCacheDir := FindFirstUrlCacheEntry(nil, lpEntryInfo^, dwEntrySize); if (hCacheDir <> 0) then DeleteUrlCacheEntry(lpEntryInfo^.lpszSourceUrlName); FreeMem(lpEntryInfo); 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 DeleteUrlCacheEntry(lpEntryInfo^.lpszSourceUrlName); FreeMem(lpEntryInfo); end; until (dwLastError = ERROR_NO_MORE_ITEMS); ShowMessage('临时文件清除成功!'); end;
【文件预览】:
srcfans.com
----清理Windows上网临时文件()
--------Project1.res(876B)
--------Unit1.dcu(4KB)
--------Unit1.dfm(547B)
--------Project1.cfg(434B)
--------Project1.dpr(188B)
--------Project1.dof(3KB)
--------Unit1.pas(1KB)