Page 1 of 2
Delete Files From Temp\Temporary Internet Files\Recent....
Posted: Sun May 18, 2003 2:28 pm
by ADN
Hi, just a question ;
How To Delete Files From Temp\Temporary Internet Files\Recent\History Folders ?
Thank

Posted: Sun May 18, 2003 4:01 pm
by FloHimself
Hi,
check this:
http://www.mvps.org/access/api/api0054.htm
on retrieving a Special Folder's location.
this is a fast hack to PB from the above site:
Code: Select all
;This code was originally written by Dev Ashish.
;It is not to be altered or distributed,
;except as part of an application.
;You are free to use it in any application,
;provided the copyright notice is left unchanged.
;
;Code Courtesy of
;Dev Ashish
;
; The following table outlines the different DLL versions,
; and how they were distributed.
;
; Version DLL Distribution Platform
; 4.00 All Microsoft® Windows® 95/Windows NT® 4.0.
; 4.70 All Microsoft® Internet Explorer 3.x.
; 4.71 All Microsoft® Internet Explorer 4.0
; 4.72 All Microsoft® Internet Explorer 4.01 and Windows® 98
; 5.00 Shlwapi.dll Microsoft® Internet Explorer 5
; 5.00 Shell32.dll Microsoft® Windows® 2000.
; 5.80 Comctl32.dll Microsoft® Internet Explorer 5
; 5.81 Comctl32.dll Microsoft® Windows 2000
;
;
; © Microsoft. Information copied from Microsoft;s
; Platform SDK Documentation in MSDN
; (http://msdn.microsoft.com)
;
; If a special folder does not exist, you can force it to be
; created by using the following special CSIDL:
; (Version 5.0)
#CSIDL_FLAG_CREATE = $8000
; Combine this CSIDL with any of the CSIDLs listed below
; to force the creation of the associated folder.
; The remaining CSIDLs correspond to either file system or virtual folders.
; Where the CSIDL identifies a file system folder, a commonly used path
; is given as an example. Other paths may be used. Some CSIDLs can be
; mapped to an equivalent %VariableName% environment variable.
; CSIDLs are much more reliable, however, and should be used if at all possible.
; File system directory that is used to store administrative tools for an individual user.
; The Microsoft Management Console will save customized consoles to
; this directory and it will roam with the user.
; (Version 5.0)
#CSIDL_ADMINTOOLS = $30
; File system directory that corresponds to the user;s
; nonlocalized Startup program group.
#CSIDL_ALTSTARTUP = $1D
; File system directory that serves as a common repository for application-specific
; data. A typical path is C:\Documents and Settings\username\Application Data.
; This CSIDL is supported by the redistributable ShFolder.dll for systems that do
; not have the Internet Explorer 4.0 integrated shell installed.
; (Version 4.71)
#CSIDL_APPDATA = $1A
; Virtual folder containing the objects in the user;s Recycle Bin.
#CSIDL_BITBUCKET = $A
; File system directory containing containing administrative tools
; for all users of the computer.
; Version 5
#CSIDL_COMMON_ADMINTOOLS = $2F
; File system directory that corresponds to the nonlocalized Startup program
; group for all users. Valid only for Windows NT® systems.
#CSIDL_COMMON_ALTSTARTUP = $1E
; Application data for all users. A typical path is
; C:\Documents and Settings\All Users\Application Data.
; Version 5
#CSIDL_COMMON_APPDATA = $23
; File system directory that contains files and folders that appear on the
; desktop for all users. A typical path is C:\Documents and Settings\All Users\Desktop.
; Valid only for Windows NT® systems.
#CSIDL_COMMON_DESKTOPDIRECTORY = $19
; File system directory that contains documents that are common to all users.
; A typical path is C:\Documents and Settings\All Users\Documents.
; Valid for Windows NT® systems and Windows 95 and Windows 98
; systems with Shfolder.dll installed.
#CSIDL_COMMON_DOCUMENTS = $2E
; File system directory that serves as a common repository for all users; favorite items.
; Valid only for Windows NT® systems.
#CSIDL_COMMON_FAVORITES = $1F
; File system directory that contains the directories for the common program
; groups that appear on the Start menu for all users. A typical path is
; C:\Documents and Settings\All Users\Start Menu\Programs.
; Valid only for Windows NT® systems.
#CSIDL_COMMON_PROGRAMS = $17
; File system directory that contains the programs and folders that appear on
; the Start menu for all users. A typical path is
; C:\Documents and Settings\All Users\Start Menu.
; Valid only for Windows NT® systems.
#CSIDL_COMMON_STARTMENU = $16
; File system directory that contains the programs that appear in the
; Startup folder for all users. A typical path is
; C:\Documents and Settings\All Users\Start Menu\Programs\Startup.
; Valid only for Windows NT® systems.
#CSIDL_COMMON_STARTUP = $18
; File system directory that contains the templates that are available to all users.
; A typical path is C:\Documents and Settings\All Users\Templates.
; Valid only for Windows NT® systems.
#CSIDL_COMMON_TEMPLATES = $2D
; Virtual folder containing icons for the Control Panel applications.
#CSIDL_CONTROLS = $3
; File system directory that serves as a common repository for Internet cookies.
; A typical path is C:\Documents and Settings\username\Cookies.
#CSIDL_COOKIES = $21
; Windows Desktop—virtual folder that is the root of the namespace..
#CSIDL_DESKTOP = $0
; File system directory used to physically store file objects on the desktop
; (not to be confused with the desktop folder itself).
; A typical path is C:\Documents and Settings\username\Desktop
#CSIDL_DESKTOPDIRECTORY = $10
; My Computer—virtual folder containing everything on the local computer:
; storage devices, printers, and Control Panel. The folder may
; also contain mapped network drives.
#CSIDL_DRIVES = $11
; File system directory that serves as a common repository for the user;s
; favorite items. A typical path is C:\Documents and Settings\username\Favorites.
#CSIDL_FAVORITES = $6
; Virtual folder containing fonts. A typical path is C:\WINNT\Fonts.
#CSIDL_FONTS = $14
; File system directory that serves as a common repository for
; Internet history items.
#CSIDL_HISTORY = $22
; Virtual folder representing the Internet.
#CSIDL_INTERNET = $1
; File system directory that serves as a common repository for
; temporary Internet files. A typical path is
; C:\Documents and Settings\username\Temporary Internet Files.
#CSIDL_INTERNET_CACHE = $20
; File system directory that serves as a data repository for local
; (non-roaming) applications. A typical path is
; C:\Documents and Settings\username\Local Settings\Application Data.
; Version 5
#CSIDL_LOCAL_APPDATA = $1C
; My Pictures folder. A typical path is
; C:\Documents and Settings\username\My Documents\My Pictures.
; Version 5
#CSIDL_MYPICTURES = $27
; A file system folder containing the link objects that may exist in the
; My Network Places virtual folder. It is not the same as CSIDL_NETWORK,
; which represents the network namespace root. A typical path is
; C:\Documents and Settings\username\NetHood.
#CSIDL_NETHOOD = $13
; Network Neighborhood—virtual folder representing the
; root of the network namespace hierarchy.
#CSIDL_NETWORK = $12
; File system directory that serves as a common repository for documents.
; A typical path is C:\Documents and Settings\username\My Documents.
#CSIDL_PERSONAL = $5
; Virtual folder containing installed printers.
#CSIDL_PRINTERS = $4
; File system directory that contains the link objects that may exist in the
; Printers virtual folder. A typical path is
; C:\Documents and Settings\username\PrintHood.
#CSIDL_PRINTHOOD = $1B
; User;s profile folder.
; Version 5
#CSIDL_PROFILE = $28
; Program Files folder. A typical path is C:\Program Files.
; Version 5
#CSIDL_PROGRAM_FILES = $2A
; A folder for components that are shared across applications. A typical path
; is C:\Program Files\Common.
; Valid only for Windows NT® and Windows® 2000 systems.
; Version 5
#CSIDL_PROGRAM_FILES_COMMON = $2B
; Program Files folder that is common to all users for x86 applications
; on RISC systems. A typical path is C:\Program Files (x86)\Common.
; Version 5
#CSIDL_PROGRAM_FILES_COMMONX86 = $2C
; Program Files folder for x86 applications on RISC systems. Corresponds
; to the %PROGRAMFILES(X86)% environment variable.
; A typical path is C:\Program Files (x86).
; Version 5
#CSIDL_PROGRAM_FILESX86 = $2A
; File system directory that contains the user;s program groups (which are
; also file system directories). A typical path is
; C:\Documents and Settings\username\Start Menu\Programs.
#CSIDL_PROGRAMS = $2
; File system directory that contains the user;s most recently used documents.
; A typical path is C:\Documents and Settings\username\Recent.
; To create a shortcut in this folder, use SHAddToRecentDocs. In addition to
; creating the shortcut, this function updates the shell;s list of recent documents
; and adds the shortcut to the Documents submenu of the Start menu.
#CSIDL_RECENT = $8
; File system directory that contains Send To menu items. A typical path is
; C:\Documents and Settings\username\SendTo.
#CSIDL_SENDTO = $9
; File system directory containing Start menu items.
; A typical path is C:\Documents and Settings\username\Start Menu.
#CSIDL_STARTMENU = $B
; File system directory that corresponds to the user;s Startup program group.
; The system starts these programs whenever any user logs onto Windows NT® or
; starts Windows® 95. A typical path is
; C:\Documents and Settings\username\Start Menu\Programs\Startup.
#CSIDL_STARTUP = $7
; System folder. A typical path is C:\WINNT\SYSTEM32.
; Version 5
#CSIDL_SYSTEM = $25
; System folder for x86 applications on RISC systems.
; A typical path is C:\WINNT\SYS32X86.
; Version 5
#CSIDL_SYSTEMX86 = $29
; File system directory that serves as a common repository
; for document templates.
#CSIDL_TEMPLATES = $15
; Version 5.0. Windows directory or SYSROOT. This corresponds to the %windir%
; or %SYSTEMROOT% environment variables. A typical path is C:\WINNT.
#CSIDL_WINDOWS = $24
#NOERROR = 0
#MAX_PATH = 260
Procedure.s GetSpecialFolderLocation(lngCSIDL.l)
; Returns path To a special folder on the machine
;
; Refer to the comments in declarations for OS and
; IE dependent CSIDL values.
Protected lngRet.l
Protected strLocation.s
Protected pidl.l
strLocation = Space(#MAX_PATH)
; retrieve a PIDL for the specified location
lngRet = SHGetSpecialFolderLocation_(0, lngCSIDL, @pidl)
If lngRet = #NOERROR
; convert the pidl to a physical path
SHGetPathFromIDList_(pidl, @strLocation)
If lngRet = #NOERROR
; If successful, Return the location
ProcedureReturn RTrim(strLocation)
EndIf
; calling application is responsible for freeing the allocated memory
; for pidl when calling SHGetSpecialFolderLocation. We have to
; call IMalloc::Release, but to get to IMalloc, a tlb is required.
;
; According to Kraig Brockschmidt in Inside OLE, CoTaskMemAlloc,
; CoTaskMemFree, and CoTaskMemRealloc take the same parameters
; as the interface functions and internally call CoGetMalloc, the
; appropriate IMalloc function, and then IMalloc::Release.
CoTaskMemFree_(pidl)
EndIf
EndProcedure
; TEST CALL
Debug GetSpecialFolderLocation(#CSIDL_HISTORY)
now its up to you to delete all files in that folder.. take care
FloHimself
delete file ?
Posted: Sun May 18, 2003 4:52 pm
by ADN
Yes, but for delete file ?
this code no work
Code: Select all
DeleteFile(C:\Documents and Settings\username\Temporary Internet Files\xxx.html)
Thank
Posted: Sun May 18, 2003 5:28 pm
by FloHimself
Sorry, have only checked out to get the path to the directory. You can't simply delete the history this way you trying to.. the history files are packed together in a index.dat in a hidden subdirectory of the history directory. Almost the same for cached pages..
You can try to access the ClearHistory() function from InternetExplorer CUrlHistory class i think.. but you need to know about COM Objects and CallCOM().. :roll:
Posted: Sun May 18, 2003 6:19 pm
by Henrik
Hi ADN ... What's in .. What's in the "xxx.html" uhhh
but What's your Os
First of you don't got any dir's called >Documents and Settings\<
next: the path must be corect
Then..
you forgot the -> " " <-
Ex. From my computer ( win98)
Code: Select all
DeleteFile("C:\windows\Temporary Internet Files\Content.ie5\0tinw163\bild11b[1].jpg")
DeleteFile("C:\windows\Recent\part240.zip.lnk")
Bedst Regards
Henrik.
Posted: Sun May 18, 2003 6:49 pm
by FloHimself
What's in the "xxx.html" uhhh
hehe.. we all know it
So what you are excactly trying to do? Deleting a special temp file from browser cache? Or delete the browser history?
FloHimself
Posted: Sun May 18, 2003 6:57 pm
by Henrik
Hi ADN
I knew it was somewere on the forum
And found 1 ex. to special folders by Hi-Toro
There was an error in it (S H I T MID) IN- case the forum writes
"****MID" you must S_H_I_T insted of the (*)
Here go's... Credit to Hi-Toro..
Code: Select all
; Get system folder location...
#CSIDL_INTERNET = $1
#CSIDL_PROGRAMS = $2
#CSIDL_CONTROLS = $3
#CSIDL_PRINTERS = $4
#CSIDL_PERSONAL = $5 ; Use this instead of CSIDL_MYDOCUMENTS. I don't know why! Ask Microsoft...
#CSIDL_FAVORITES = $6
#CSIDL_STARTUP = $7
#CSIDL_RECENT = $8
#CSIDL_SENDTO = $9
#CSIDL_BITBUCKET = $A
#CSIDL_STARTMENU = $B
#CSIDL_MYDOCUMENTS = $C
#CSIDL_MYMUSIC = $D
#CSIDL_MYVIDEO = $E
#CSIDL_DESKTOPDIRECTORY = $10
#CSIDL_DRIVES = $11
#CSIDL_NETWORK = $12
#CSIDL_NETHOOD = $13
#CSIDL_FONTS = $14
#CSIDL_TEMPLATES = $15
#CSIDL_COMMON_STARTMENU = $16
#CSIDL_COMMON_PROGRAMS = $17
#CSIDL_COMMON_STARTUP = $18
#CSIDL_COMMON_DESKTOPDIRECTORY = $19
#CSIDL_APPDATA = $1A
#CSIDL_PRINTHOOD = $1B
#CSIDL_LOCAL_APPDATA = $1C
#CSIDL_ALTSTARTUP = $1D
#CSIDL_COMMON_ALTSTARTUP = $1E
#CSIDL_COMMON_FAVORITES = $1F
#CSIDL_INTERNET_CACHE = $20
#CSIDL_COOKIES = $21
#CSIDL_HISTORY = $22
#CSIDL_COMMON_APPDATA = $23
#CSIDL_WINDOWS = $24
#CSIDL_SYSTEM = $25
#CSIDL_PROGRAM_FILES = $26
#CSIDL_MYPICTURES = $27
#CSIDL_PROFILE = $28
#CSIDL_SYSTEMX86 = $29
#CSIDL_PROGRAM_FILESX86 = $2A
#CSIDL_PROGRAM_FILES_COMMON = $2B
#CSIDL_PROGRAM_FILES_COMMONX86 = $2C
#CSIDL_COMMON_TEMPLATES = $2D
#CSIDL_COMMON_DOCUMENTS = $2E
#CSIDL_COMMON_ADMINTOOLS = $2F
#CSIDL_ADMINTOOLS = $30
#CSIDL_CONNECTIONS = $31
#CSIDL_COMMON_MUSIC = $35
#CSIDL_COMMON_PICTURES = $36
#CSIDL_COMMON_VIDEO = $37
#CSIDL_RESOURCES = $38
#CSIDL_RESOURCES_LOCALIZED = $39
#CSIDL_COMMON_OEM_LINKS = $3A
#CSIDL_CDBURN_AREA = $3B
#CSIDL_COMPUTERSNEARME = $3D
#CSIDL_FLAG_PER_USER_INIT = $800
#CSIDL_FLAG_NO_ALIAS = $1000
#CSIDL_FLAG_DONT_VERIFY = $4000
#CSIDL_FLAG_CREATE = $8000
#CSIDL_FLAG_MASK = $FF00
Structure SHITEMID
cb.b
abID.b[1]
EndStructure
Structure ITEMIDLIST
mkid.SHITEMID
EndStructure
Procedure.s GetSystemFolder (folder)
*itemid.ITEMIDLIST = #NULL
If SHGetSpecialFolderLocation_ (0, folder, @*itemid) = #NOERROR
location$ = Space (#MAX_PATH)
If SHGetPathFromIDList_ (*itemid, @location$)
ProcedureReturn location$
EndIf
EndIf
EndProcedure
; D E M O . . .
folder$ = GetSystemFolder (#CSIDL_PERSONAL)
MessageRequester ("Result...", "The 'My Documents' folder is located in " + Chr (34) + folder$ + Chr (34), #MB_ICONINFORMATION)
End
Well it worked no edit needed
@Flo. both i would guess..
Bedst Regards
Henrik.
Posted: Sun May 18, 2003 7:08 pm
by FloHimself
Isn't it basicly the same posted above!?
You were faster
btw: here a way using CallCOM() to clear the Internet Explorer History
Code: Select all
; Clear Internet Explorer Histroy
; Tested on Win XP SP1 IE6.0.2800....
Procedure ClearIEHistory()
#IUrlHistoryStg2_QueryInterface = 0
#IUrlHistoryStg2_AddRef = 4
#IUrlHistoryStg2_Release = 8
#IUrlHistoryStg2_ClearHistory = 36
procRet = 0
CoInitialize_(0)
If CoCreateInstance_(?CLSID_CUrlHistory, 0, 1, ?IID_IUrlHistoryStg2, @myObject) = 0
CallCOM(#IUrlHistoryStg2_ClearHistory, myObject)
CallCOM(#IUrlHistoryStg2_Release, myObject)
procRet= 1
EndIf
ProcedureReturn procRet
DataSection
CLSID_CUrlHistory:
; 3C374A40-BAE4-11CF-BF7D-00AA006946EE
Data.l $3C374A40
Data.w $BAE4,$11CF
Data.b $BF,$7D,$00,$AA,$00,$69,$46,$EE
IID_IUrlHistoryStg2:
; AFA0DC11-C313-11D0-831A-00C04FD5AE38
Data.l $AFA0DC11
Data.w $C313,$11D0
Data.b $83,$1A,$00,$C0,$4F,$D5,$AE,$38
EndDataSection
EndProcedure
; TEST CALL
Debug ClearIEHistory()
edited code:
moved CallCOM(#IUrlHistoryStg2_Release, myObject) into IF ENDIF block to prevent runtime error on releasing a not existing instance, when CoCreateInstance_() fails
FloHimself
Posted: Sun May 18, 2003 7:14 pm
by Henrik
FloHimself wrote:Isn't it basicly the same posted above!?
FloHimself
Hey sorry flo
I did'nt look close enough, i thought it was only the Api-constants and not an working example.. Sorry flo 8O
Hi your code works nicely on win98 too
heh.
Bedst Regards
Henrik[/quote]
Posted: Sun May 18, 2003 7:22 pm
by FloHimself
@Hendrik no problem, better 2 times.. then no anwser at all
btw i haven't searched for Hi-Toro's example before.. just translated it again.. so i haven't checked if it works on all directorys
fine thanks for testing, maybe we should use a chat
...
Posted: Mon May 19, 2003 10:36 am
by Hi-Toro
I was going to post that code last night, but I ran into the same problem with the hidden sub-folders
That COM procedure looks good though!
Posted: Tue May 20, 2003 11:49 am
by Julien
This code no work (2000 and XP Home SP1)
Code: Select all
DeleteFile("C:\Documents and Settings\Julien.PERSONNAL\Local Settings\Temporary Internet Files\myfile.jpg")
How to see and delete temporary Internet files ?
Posted: Tue May 20, 2003 8:11 pm
by FloHimself
Check Microsoft MSDN
http://msdn.microsoft.com/library/defau ... aching.asp on how caching is organized.
Use WinInet Functions to enumerate the Cache entrys..
FindFirstUrlCacheEntry -> Begins the enumeration of the Internet cache
FindNextUrlCacheEntry -> Retrieves the next entry in the Internet cache
FindFirstUrlCacheGroup -> Initiates the enumeration of the cache groups in the Internet cache
FindNextUrlCacheGroup -> Retrieves the next cache group in a cache group enumeration started by FindFirstUrlCacheGroup
Posted: Wed Aug 27, 2003 9:39 pm
by TerryHough
[quote="FloHimself"]btw: here a way using CallCOM() to clear the Internet Explorer History
Code: Select all
; Clear Internet Explorer Histroy
; Tested on Win XP SP1 IE6.0.2800....
Procedure ClearIEHistory()
#IUrlHistoryStg2_QueryInterface = 0
#IUrlHistoryStg2_AddRef = 4
#IUrlHistoryStg2_Release = 8
#IUrlHistoryStg2_ClearHistory = 36
procRet = 0
CoInitialize_(0)
If CoCreateInstance_(?CLSID_CUrlHistory, 0, 1, ?IID_IUrlHistoryStg2, @myObject) = 0
CallCOM(#IUrlHistoryStg2_ClearHistory, myObject)
CallCOM(#IUrlHistoryStg2_Release, myObject)
procRet= 1
EndIf
ProcedureReturn procRet
DataSection
CLSID_CUrlHistory:
; 3C374A40-BAE4-11CF-BF7D-00AA006946EE
Data.l $3C374A40
Data.w $BAE4,$11CF
Data.b $BF,$7D,$00,$AA,$00,$69,$46,$EE
IID_IUrlHistoryStg2:
; AFA0DC11-C313-11D0-831A-00C04FD5AE38
Data.l $AFA0DC11
Data.w $C313,$11D0
Data.b $83,$1A,$00,$C0,$4F,$D5,$AE,$38
EndDataSection
EndProcedure
; TEST CALL
Debug ClearIEHistory()
?? Doesn't work for me on Win98SE, IE6 ??
Terry
Posted: Thu Aug 28, 2003 3:48 pm
by FloHimself
maybe the function depends on the operation system and not on internet explorer.. see (minimum operating systems):
http://msdn.microsoft.com/library/defau ... istory.asp