Solved

Question about cookies and temporary internet files

Posted on 2004-04-16
1
361 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
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

685 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