VB Takes Out The Trash
Empties the Recycle Bin, regardless of what drive/folder assigned to.
Inputs
None.
Assumes
No form required. (Sample uses a standard module instead of a form).
Returns
None.
Side Effects
Empties the Recycle Bin. If workstation has more than one drive, *all* Recycled folders (e.g. C:\Recycled) on *all* drives are emptied.
API Declarations
SHEmptyRecycleBin (Shell32)
Rate VB Takes Out The Trash
(2(2 Vote))
' ShellTrash Demo
' by Barry L. Camp ([email protected])
Option Explicit ' The Author's preference.
Const SHERB_NOCONFIRMATION = &H1& ' No dialog confirming the deletion of the objects will be displayed.
Const SHERB_NOPROGRESSUI = &H2& ' No dialog indicating the progress will be displayed.
Const SHERB_NOSOUND = &H4& ' No sound will be played when the operation is complete.
Private Declare Function SHEmptyRecycleBin Lib "shell32" Alias "SHEmptyRecycleBinA" _
(ByVal hWnd As Long, ByVal lpBuffer As String, ByVal dwFlags As Long) As Long
Sub Main()
Dim rc As Long
Dim nFlags As Long
' Suppresses all UI elements, for "quiet" operation.
nFlags = SHERB_NOCONFIRMATION Or SHERB_NOPROGRESSUI Or SHERB_NOSOUND
rc = SHEmptyRecycleBin(0&, vbNullString, nFlags)
End Sub
VB Takes Out The Trash Comments
No comments yet — be the first to post one!
Post a Comment