Solved

Question about cookies and temporary internet files

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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

762 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now