Solved

Question about cookies and temporary internet files

Posted on 2004-04-16
1
362 Views
Last Modified: 2010-05-02
How can i delete the cookies and all temporary internet files with visual basic?
0
Comment
Question by:macaila
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 17

Accepted Solution

by:
zzzzzooc earned 78 total points
ID: 10841044
To recursively delete all files/folders..

http://www.experts-exchange.com/Programming/Programming_Languages/Visual_Basic/Q_20804304.html

To get the paths to the cache/cookies..


Form1:
-----------------

Option Explicit

Private Declare Function SHGetPathFromIDList Lib "shell32" Alias "SHGetPathFromIDListA" (ByVal pidl As Long, ByVal pszPath As String) As Long
Private Declare Function SHGetSpecialFolderLocation Lib "shell32" (ByVal hwndOwner As Long, ByVal nFolder As Long, pidl As Long) As Long

Private Declare Sub CoTaskMemFree Lib "ole32" (ByVal pv As Long)

Private Const CSIDL_INTERNET_CACHE = &H20
Private Const CSIDL_COOKIES = &H21
Private Function GetSpecialFolderLocation(ByVal CSIDL As Long) As String
    Dim sPath As String, lID As Long
    If SHGetSpecialFolderLocation(Me.hWnd, CSIDL, lID) = 0 Then
        sPath = Space(256)
        If SHGetPathFromIDList(lID, sPath) = 1 Then
            GetSpecialFolderLocation = Left(sPath, InStr(sPath, vbNullChar) - 1)
        End If
        Call CoTaskMemFree(lID)
    End If
End Function
Private Sub Form_Load()
    Dim sCache As String, sCookies As String
    sCache = GetSpecialFolderLocation(CSIDL_INTERNET_CACHE)
    sCookies = GetSpecialFolderLocation(CSIDL_COOKIES)
    'implement recursive dir/file deletion on above folders..
    '........
    '........
End Sub
0

Featured Post

Enroll in May's Course of the Month

May’s Course of the Month is now available! Experts Exchange’s Premium Members and Team Accounts have access to a complimentary course each month as part of their membership—an extra way to increase training and boost professional development.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How to produce a SHA-1 hash function in vb6 in order to save it to a table 8 74
Excel Automation VBA 19 116
Automatic Email Reminder 4 94
Sub or Function is not defined 6 59
Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

739 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