469,610 Members | 1,745 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,610 developers. It's quick & easy.

Empty Recycle bin - VB.NET code

Hi All

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

Regards
Vighneswar
Jul 7 '06 #1
2 9231
Hello vighnesh,
Hi All

Can Anybody Please help me in how to Empty a Recycle bin using VB.NET
code ?
I believe that you need to P/Invoke for this functionality. Good news is
that there is a sample up on Pinvoke.net to do this very thing.

http://www.pinvoke.net/default.aspx/...ecycleBin.html
--
Jared Parsons [MSFT]
ja******@online.microsoft.com
All opinions are my own. All content is provided "AS IS" with no warranties,
and confers no rights.
Jul 7 '06 #2
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
"vighnesh" <vi******@nannacomputers.comwrote in message
news:en**************@TK2MSFTNGP05.phx.gbl...
Hi All

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


Jul 7 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Thomas Halwax | last post: by
7 posts views Thread by Clinton Pierce | last post: by
3 posts views Thread by laredotornado | last post: by
12 posts views Thread by Cmtk Software | last post: by
reply views Thread by devrayhaan | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.