I need to delete all files in recycle bin
Anybody know how to this?
Try this :
Private Declare Function SHEmptyRecycleBin Lib "shell32.dll" Alias "SHEmptyRecycleBinA" (ByVal hwnd As Long,ByVal pszRootPath As String,ByVal dwFlags As Long) As Long Private Const SHERB_NORMAL = &H10 Private Const SHERB_NOCONFIRMATION = &H1 Private Const SHERB_NOPROGRESSUI = &H2 Private Const SHERB_NOSOUND = &H4 Private Const SHERB_NOALL = _ (SHERB_NOCONFIRMATION And _ SHERB_NOPROGRESSUI And SHERB_NOSOUND) Dim RetVal As Long Private Sub Command1_Click() Dim y as Integer y = MsgBox("Are u sure to clean up Recycle Bin ? ", vbYesNo, "Confirmation" If y = vbYes Then RetVal = SHEmptyRecycleBin(0&,vbNullString,&H1) MsgBox "Recycle Bin has been cleaned" End If End Sub
We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.