Solved

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

Posted on 2011-02-23
4
460 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
ID: 34967351
The following routine deletes everything.
http://delphi.about.com/cs/adptips1999/a/bltip1199_2.htm
0
 
LVL 8

Expert Comment

by:jimsweb
ID: 34967354
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
ID: 34967495
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
ID: 34967511
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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

773 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