Empty Recycle bin - VB.NET code

V

vighnesh

Hi All

Can Anybody Please help me in how to Empty a Recycle bin using VB.NET code ?

Regards
Vighneswar
 
P

Peter

This is how you do it:

Private Declare Function SHEmptyRecycleBin Lib "shell32.dll" Alias
"SHEmptyRecycleBinA" (ByVal hWnd As Int32, ByVal pszRootPath As String,
ByVal dwFlags As Int32) As Int32
Private Declare Function SHUpdateRecycleBinIcon Lib "shell32.dll" () As
Int32

Private Const SHERB_NOCONFIRMATION = &H1
Private Const SHERB_NOPROGRESSUI = &H2
Private Const SHERB_NOSOUND = &H4

#Region "Empty Recycle Bin (SUB)"

Private Sub EmptyRecycleBin()
SHEmptyRecycleBin(Me.Handle.ToInt32, vbNullString, SHERB_NOCONFIRMATION +
SHERB_NOSOUND)
SHUpdateRecycleBinIcon()
End Sub

#End Region

I hope this helps,

Crouchie1998
MCP MCSE
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top