Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: VB4/32,VB5,VB6
Expertise: Intermediate
Oct 2, 1999

RecycleBinItems - Get info on the items in the Recycle Bin

Option Explicit

Private Type SHQUERYRBINFO
    cbSize As Long           ' bytes in this structure
    i64Size As Currency      ' 64-bit integer with size of items in the Recycle 
                             ' Bin
    i64NumItems As Currency   ' 64-bit integer with number of items in the 
                              ' Recycle Bin
End Type

Private Declare Function SHQueryRecycleBin Lib "shell32.dll" Alias _
    "SHQueryRecycleBinA" (ByVal pszRootPath As String, _
    QueryInfo As SHQUERYRBINFO) As Long

' Return number of items in the Recycle Bin for the
' specified drive, or all drives if the argument is
' a null string
'
' If you pass a second argument, it is filled with the
' total size of the items in the Recycle Bin for that drive

Function RecycleBinItems(ByVal RootPath As String, _
    Optional NumBytes As Currency) As Long
    Dim qInfo As SHQUERYRBINFO

    ' add a colon and backslash, if missing
    If Len(RootPath) > 0 And Mid$(RootPath, 2, 2) <> ":\" Then
        RootPath = Left$(RootPath, 1) & ":\"
    End If
    qInfo.cbSize = Len(qInfo)
    Debug.Print SHQueryRecycleBin(RootPath, qInfo)
    ' scale up the result
    RecycleBinItems = qInfo.i64NumItems * 10000
    ' return the size in the second argument
    NumBytes = qInfo.i64Size * 10000
End Function
Francesco Balena
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date