Article View: borland.public.cppbuilder.nativeapi
Article #2861Re: Internet Options -> Delete Files...
From: Jonathan Benedicto
Date: Tue, 12 Dec 2006 18:06
Date: Tue, 12 Dec 2006 18:06
56 lines
2532 bytes
2532 bytes
Danzer wrote:
> Is there a way to programmatically delete all offline content for internet
> explorer? I have googled for some type of api call, but have found
> nothing.
How programmatically? :-) Would this do:
// Completely Untested
void ProcessFolder( AnsiString Folder, TStringList *FileList )
{
HANDLE FindHandle;
WIN32_FIND_DATA FindData;
AnsiString SearchPattern;
SearchPattern = AnsiString( Folder ) + "\\*.*";
FindHandle = FindFirstFile( SearchPattern.c_str(), &FindData );
if( FindHandle != INVALID_HANDLE_VALUE )
{
// I *think* that the first item will always be ".", so I *think* it
can be ignored.
while( FindNextFile( FindHandle, &FindData ) )
{
AnsiString FileName = FindData.cFileName;
if( ( FindData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY ) ==
FILE_ATTRIBUTE_DIRECTORY )
ProcessFolder( Folder + "\\" + FileName, FileList );
else if( FileName.SubString( 1, 7 ) != "cookie:" )
FileList->Add( Folder + "\\" + FileName );
}
FindClose( FindHandle );
}
}
int i, l;
char Folder[ MAX_PATH + 1 ] = { 0 };
TStringList *FileList = new TStringList();
SHGetFolderPath( NULL, CSIDL_INTERNET_CACHE, NULL, SHGFP_TYPE_CURRENT,
Folder );
ProcessFolder( Folder, FileList );
l = FileList->Count;
for( i = 0; i < l; ++i )
DeleteFile( FileList->Strings[ i ] );
delete FileList;
HTH
Jonathan
Technical Details
Message-ID:
<457eef64$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news2.google.com!news4.google.com!news3.google.com!news2.volia.net!hwmnpeer01.ams!news.highwinds-media.com!feeder1.cambrium.nl!feed.tweaknews.nl!news2.euro.net!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<457ed32b$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,540433827638e9a X-Google-Attributes: gid10cc67,public X-Google-Language: ENGLISH,ASCII-7-bit From: "Jonathan Benedicto" <invalid@nobody.com> Newsgroups: borland.public.cppbuilder.nativeapi References: <457ed32b$1@newsgroups.borland.com> Subject: Re: Internet Options -> Delete Files... Date: Tue, 12 Dec 2006 13:06:39 -0500 Lines: 58 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.2869 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2962 X-RFC2646: Format=Flowed; Response NNTP-Posting-Host: 74.115.18.89 Message-ID: <457eef64$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1165946724 74.115.18.89 (12 Dec 2006 10:05:24 -0700) Path: arc1-ca.pugleaf.net!g2news2.google.com!news4.google.com!news3.google.com!news2.volia.net!hwmnpeer01.ams!news.highwinds-media.com!feeder1.cambrium.nl!feed.tweaknews.nl!news2.euro.net!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail