Search Tools Links Login

Get Recyclebin Info


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: http://math.msu.su/~vfnik/WinApi/index.html

Original Author: Chinese Guy

Code

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


About this post

Posted: 2003-06-01
By: ArchiveBot
Viewed: 93 times

Categories

Visual Basic 6

Attachments

No attachments for this post


Loading Comments ...

Comments

No comments have been added for this post.

You must be logged in to make a comment.