Solved

in Delphi - How can I delete the contents of the temporary folder that Internet Explorer uses?

Posted on 2011-02-23
4
450 Views
Last Modified: 2012-08-14
Thanks for reading.

I simply want to delete the contents of the temporary folder that Internet Explorer uses?

This is usually:

C:\Documents and Settings\USERNAME\Local Settings\Temporary Internet Files\

but these files are kinda "special" I think...

Anyone know how to delete this folder's content?

Thanks!
0
Comment
Question by:bobbysdog
  • 2
4 Comments
 
LVL 8

Expert Comment

by:jimsweb
Comment Utility
The following routine deletes everything.
http://delphi.about.com/cs/adptips1999/a/bltip1199_2.htm
0
 
LVL 8

Expert Comment

by:jimsweb
Comment Utility
This article is also dealing with temporary directories. Hope it helps.
http://stackoverflow.com/questions/503312/deleting-a-temporary-directory-in-delphi
0
 
LVL 24

Accepted Solution

by:
jimyX earned 500 total points
Comment Utility
You can use this code from delphi.about.com:
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;

procedure TForm1.Button1Click(Sender: TObject) ;
begin
   DeleteIECache;
end;

Open in new window

http://delphi.about.com/cs/adptips2002/a/bltip1002_2.htm
0
 

Author Closing Comment

by:bobbysdog
Comment Utility
woo hoo thanks

p.s. i tried the other 2 solutions. they didnt work cuz the temp internet files folder is too exotic. but thank you very much for your input
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now