Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Question about cookies and temporary internet files

Posted on 2004-04-16
1
Medium Priority
?
365 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 312 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

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

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

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…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
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…
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…
Suggested Courses

715 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