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
Solved

Question about cookies and temporary internet files

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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

809 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