Ermöglicht zum einen die Anzahl der im Papierkorb befindlichen Dateien, als auch deren Gesamtgröße zu efahren.
Aufruf zb mit:
GetBinsData("C:")
Private Declare Function SHQueryRecycleBin Lib "shell32.dll" Alias "SHQueryRecycleBinA"(ByVal pszRootPath As String, ByRef pSHQueryRBInfo As SHQUERYRBINFO) As Integer
Private Structure ULARGE_INTEGER
Dim Lo As Integer
Dim Hi As Integer
End Structure
Private Structure SHQUERYRBINFO
Dim cbSize As Integer
Dim i64Size As ULARGE_INTEGER
Dim i64NumItems As ULARGE_INTEGER
End Structure
Private Sub GetBinsData(ByRef rbPath As String)
Dim i As Short
Dim RB As SHQUERYRBINFO
Dim size As Integer
Dim files As Integer
RB.cbSize = Len(RB)
If Len(rbPath) = 0 Then
For i = Asc("A") To Asc("Z")
Call SHQueryRecycleBin(Chr(i) & ":", RB)
size = size + RB.i64Size.Lo \ 1024
files = files + RB.i64NumItems.Lo
Next i
Label1.Text = CStr(files)
Label2.Text = Format(size \ 1024, "###,###,### kB")
Else
Call SHQueryRecycleBin(rbPath, RB)
Label1.Text = CStr(RB.i64NumItems.Lo)
Label2.Text = Format(RB.i64Size.Lo \ 1024, "###,###,### kB")
End If
End Sub
Kommentare zum Snippet