by Chinese Guy (2 Submissions)
Category: Miscellaneous
Compatability: Visual Basic 5.0
Difficulty: Beginner
Date Added: Wed 3rd February 2021
Rating:
(2 Votes)
This is not my code. I read it on some website. This code retrieves info about Recyclebin ( number of items in the bin, size of these items).
Here's the website address: https://math.msu.su/~vfnik/WinApi/index.html
I recommend going to the website
"http://math.msu.su/~vfnik/WinApi/index.html"
throw two textboxes, one commandbutton on the form
give the names txtBinSize & txtNumItems to textboxes
Private Const S_OK = &H0
Private Type ULARGE_INTEGER
LowPart As Long
HighPart As Long
End Type
Private Type SHQUERYRBINFO
cbSize As Long
i64Size As ULARGE_INTEGER
i64NumItems As ULARGE_INTEGER
End Type
Private Declare Function SHQueryRecycleBin Lib "shell32.dll" _
Alias "SHQueryRecycleBinA" (ByVal pszRootPath As String, _
pSHQueryRBInfo As SHQUERYRBINFO) As Long
Private Sub Command1_Click()
' Display the number of items in the Recycle Bin on the C: drive and the size of it.
'information about the bin
Dim rbinfo As SHQUERYRBINFO
Dim retval As Long ' return value
' Initialize the size of the structure.
rbinfo.cbSize = Len(rbinfo)
' Query the contents of C:'s Recycle Bin.
' the path doesn't have to be the root path
retval = SHQueryRecycleBin("C:\", rbinfo)
' Display the number of items in the Recycle Bin, if the value is
' within Visual Basic's numeric display limits.
If (rbinfo.i64NumItems.LowPart And &H80000000) = &H80000000 Or _
rbinfo.i64NumItems.HighPart > 0 Then
txtNumItems = "Recycle Bin contains more than 2,147,483,647 items."
Else
txtNumItems = "Recycle Bin contains " & rbinfo.i64NumItems.LowPart & " items."
End If
' Likewise display the number of bytes the Recycle Bin is taking up.
If (rbinfo.i64Size.LowPart And &H80000000) = &H80000000 Or rbinfo.i64Size.HighPart > 0 Then
txtBinSize = "Recycle Bin consumes more than 2,147,483,647 bytes."
Else
txtBinSize = "Recycle Bin consumes " & rbinfo.i64Size.LowPart & " bytes."
End If
End Sub