Newsgroup: it.comp.lang.visual-basic
Titolo: cache di ie

Io odio Internet Explorer ma... vabbè non importa.
Ecco il problema: conoscete un modo per cancellare la cache di IE da
VB2005?
grazie

 --Steve P
--
Fosco

 e (testato su un 98) spegne il pc
Microsoft Windows XP [Versione 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.
C:\WINDOWS>deltree /?
"deltree" non è riconosciuto come comando interno o esterno,
 un programma eseguibile o un file batch.
anch'io ero abituato a deltree.
ora di solito da gestione risorse faccio
del *.* /s /q
per la cache, cercando doc sul webbrowser, anni fa avevo trovato il progetto 
vb6 qui sotto. ogni tanto dava errore, ma forse ci si puo' prendere spunto.
ciao, a.
FORM1
Public Sub Command1_Click()
    Dim sGroupID As Date
    Dim hGroup As Long
    Dim hFile As Long
    Dim sEntryInfo As INTERNET_CACHE_ENTRY_INFO
    Dim iSize As Long
    On Error Resume Next
    ' Delete the groups
    hGroup = FindFirstUrlCacheGroup(0, 0, 0, 0, sGroupID, 0)
    ' To avoid error using it with IE4 as FindFirstUrlCacheGroup is not 
implemented
    If Err.Number <> 453 Then
        If (hGroup = 0) And (Err.LastDllError <> 2) Then
            MsgBox "An error occurred enumerating the cache groups" & 
Err.LastDllError
            Exit Sub
        End If
    Else
        Err.Clear
    End If
    If (hGroup <> 0) Then
        'we succeeded in finding the first cache group.. enumerate and
        'delete
        Do
            If (0 = DeleteUrlCacheGroup(sGroupID, 
CACHEGROUP_FLAG_FLUSHURL_ONDELETE, 0)) Then
               ' To avoid error using it with IE4 as FindFirstUrlCacheGroup 
is not implemented
               If Err.Number <> 453 Then
                 MsgBox "Error deleting cache group " & Err.LastDllError
                 Exit Sub
               Else
                  Err.Clear
               End If
            End If
            iSize = BUFFERSIZE
            If (0 = FindNextUrlCacheGroup(hGroup, sGroupID, iSize)) And 
(Err.LastDllError <> 2) Then
                MsgBox "Error finding next url cache group! - " & 
Err.LastDllError
            End If
        Loop Until Err.LastDllError = 2
    End If
  ' Delete the files
    sEntryInfo.dwStructSize = 80
    iSize = BUFFERSIZE
    hFile = FindFirstUrlCacheEntry(0, sEntryInfo, iSize)
    If (hFile = 0) Then
        If (Err.LastDllError = ERROR_NO_MORE_ITEMS) Then
            GoTo done
        End If
        MsgBox "ERROR: FindFirstUrlCacheEntry - " & Err.LastDllError
        Exit Sub
    End If
    Do
        If (0 = DeleteUrlCacheEntry(sEntryInfo.szRestOfData(0))) _
            And (Err.LastDllError <> 2) Then
            Err.Clear
        End If
        iSize = BUFFERSIZE
        If (0 = FindNextUrlCacheEntry(hFile, sEntryInfo, iSize)) And 
(Err.LastDllError <> ERROR_NO_MORE_ITEMS) Then
            MsgBox "Error:  Unable to find the next cache entry - " & 
Err.LastDllError
            Exit Sub
        End If
    Loop Until Err.LastDllError = ERROR_NO_MORE_ITEMS
done:
    MsgBox "cache cleared"
    Command1.Enabled = True
End Sub
MODULE1
Public Declare Function FindFirstUrlCacheGroup Lib "wininet.dll" ( _
    ByVal dwFlags As Long, _
    ByVal dwFilter As Long, _
    ByRef lpSearchCondition As Long, _
    ByVal dwSearchCondition As Long, _
    ByRef lpGroupId As Date, _
    ByRef lpReserved As Long) As Long
Public Declare Function FindNextUrlCacheGroup Lib "wininet.dll" ( _
    ByVal hFind As Long, _
    ByRef lpGroupId As Date, _
    ByRef lpReserved As Long) As Long
Public Declare Function DeleteUrlCacheGroup Lib "wininet.dll" ( _
    ByVal sGroupID As Date, _
    ByVal dwFlags As Long, _
    ByRef lpReserved As Long) As Long
Public Declare Function FindFirstUrlCacheEntry Lib "wininet.dll" Alias 
"FindFirstUrlCacheEntryA" ( _
    ByVal lpszUrlSearchPattern As String, _
    ByRef lpFirstCacheEntryInfo As INTERNET_CACHE_ENTRY_INFO, _
    ByRef lpdwFirstCacheEntryInfoBufferSize As Long) As Long
Public Type INTERNET_CACHE_ENTRY_INFO
    dwStructSize As Long
    szRestOfData(1024) As Long
End Type
Public Declare Function DeleteUrlCacheEntry Lib "wininet.dll" Alias 
"DeleteUrlCacheEntryA" ( _
    ByVal lpszUrlName As Long) As Long
Public Declare Function FindNextUrlCacheEntry Lib "wininet.dll" Alias 
"FindNextUrlCacheEntryA" ( _
    ByVal hEnumHandle As Long, _
    ByRef lpNextCacheEntryInfo As INTERNET_CACHE_ENTRY_INFO, _
    ByRef lpdwNextCacheEntryInfoBufferSize As Long) As Long
Public Const CACHGROUP_SEARCH_ALL = &H0
Public Const ERROR_NO_MORE_FILES = 18
Public Const ERROR_NO_MORE_ITEMS = 259
Public Const CACHEGROUP_FLAG_FLUSHURL_ONDELETE = &H2
Public Const BUFFERSIZE = 2048

 del *.* /s /q
L'equivalente del deltree dovrebbe essere:
C:\>rd /?
Rimuove (elimina) una directory.
RMDIR [/S] [/Q] [unità:]percorso
RD [/S] [/Q] [unità:]percorso
  /S      Rimuove tutte le directory e file nella directory specificata
          oltre alla directory stessa. Usato per rimuovere l'intera
          struttura di una directory.
  /Q      Inibisce la richiesta di conferma alla rimozione della directory
          eseguita con /S.

Ok grazie cercavo proprio la chiave del registro in cui era contenuto
il nome della cartella!
grazie!