Sunday, May 27, 2012

Fungsi Untuk Memeriksa Apakah Recycle Bin Kosong?

Di bawah ini merupakan fungsi untuk memeriksa apakah recycle bin kosong? Bagaimana implementasinya dalam Visual Basic 6.0? bisa Anda simak kodenya dibawah ini:
Option Explicit 

Private Type
SHQUERYRBINFO
cbSize As Long
i64SizeLo As Long
i64SizeHi As Long
i64NumItemsLo As Long
i64NumItemsHi As Long
End Type

Private Declare Function
SHQueryRecycleBin Lib "shell32" Alias "SHQueryRecycleBinA" (ByVal pszRootPath As String, pSHQueryRBInfo As SHQUERYRBINFO) As Long

Function
IsEmptyRecycle() As Boolean
Dim
RB As SHQUERYRBINFO
RB.cbSize = Len(RB)
Call SHQueryRecycleBin("C:\", RB)
IsEmptyRecycle = (RB.i64NumItemsLo = 0)
End Function
Contoh penggunaan fungsi di atas
Private Sub Command1_Click() 
MsgBox IsEmptyRecycle
End Sub