Windows Apache (6) File Types (33) Internet Explorer (6) Network (11) Passwords (6) Printing Processes (13) Programming (318)
Exchange Links About this site Links to us 
|
Programmatically clear Internet Explorer's cache
3 comments. Current rating: (1 votes). Leave comments and/ or rate it.
Question: I need a tool to empty IE's cache on a regular basis. How can I quickly write that myself?
Answer: You can use a quick and dirty approach if you need to delete the cache only on one specific computer. In this case write a batch file that contains the following statements (replace 'administrator' with your user name):
del "c:\Temp\*.*" /ARSAH /s /q
del "c:\documents and settings\administrator\Recent\*.*" /s /q /a
del "c:\documents and settings\administrator\History\*.*" /s /q /a
del "c:\documents and settings\administrator\Temporary Internet Files\*.*" /s /q /a
If you want a more universal tool then look at the following Delphi code. You can also download the compiled executable here: Del_IE_Cache.exe (8 kB)
 | |  | | program Delete_IE_Cache;
uses
WinInet;
procedure DeleteIECache;
var
lpEntryInfo: PInternetCacheEntryInfo;
hCacheDir: LongWord;
dwEntrySize: LongWord;
begin
dwEntrySize := 0;
FindFirstUrlCacheEntry(nil, TInternetCacheEntryInfo(nil^), dwEntrySize);
GetMem(lpEntryInfo, dwEntrySize);
if dwEntrySize>0 then
lpEntryInfo^.dwStructSize := dwEntrySize;
hCacheDir := FindFirstUrlCacheEntry(nil, lpEntryInfo^, dwEntrySize);
if hCacheDir<>0 then
begin
repeat
DeleteUrlCacheEntry(lpEntryInfo^.lpszSourceUrlName);
FreeMem(lpEntryInfo, dwEntrySize);
dwEntrySize := 0;
FindNextUrlCacheEntry(hCacheDir, TInternetCacheEntryInfo(nil^), dwEntrySize);
GetMem(lpEntryInfo, dwEntrySize);
if dwEntrySize>0 then
lpEntryInfo^.dwStructSize := dwEntrySize;
until not FindNextUrlCacheEntry(hCacheDir, lpEntryInfo^, dwEntrySize)
end;
FreeMem(lpEntryInfo, dwEntrySize);
FindCloseUrlCache(hCacheDir)
end;
begin
DeleteIECache
end. | |  | |  |
Comments:
|
|
|
|
The above Delphi code when executed causes ebay and various other on-line subscription services to forget who I am. Seems to me it must be doing more than just clearing the cache. I think it's wiping out my cookies which is exactly what I didn't want to happen.
2. 'My' XP system does not have the subdirectories mentioned in the above batch file.
|
|
|
|
|
I need to delete files from the internet explorer each time i call an action to view my latest graph charts that i am creating at runtime in HTL page.
Please guide me how can i delete the interent files programmaticaaly.
|
|
|
|
|
I'm hosting an online application that displays videos. I need the users browser to pick up the latest videos.
|
|