Forums: How to empty a recycle bin
Home > Groups > Software Development Forum > Forums > How to empty a recycle bin > Messages
Reply
Displaying 1 to 2 (of 2 messages)
Page 1 of 1
Forums

Jitendra malik
How to empty a recycle bin
Last Post : 29th Nov, 2011
want to know about this code... please reply... how to run this code... say about this code man......

Dileep sahu
How to empty a recycle bin
Last Post : 29th Nov, 2011
Imports System.Windows.Forms
Imports System.Runtime.InteropServices
Imports System.Management

Public Class Form1
Inherits Form
Public Sub New()
InitializeComponent()
End Sub

Private Enum RecycleFlags As UInteger
SHRB_NOCONFIRMATION = &H1
SHRB_NOPROGRESSUI = &H2
SHRB_NOSOUND = &H4
End Enum
_
Private Shared Function SHEmptyRecycleBin(ByVal hwnd As IntPtr, ByVal pszRootPath As String, ByVal dwFlags As RecycleFlags) As UInteger
End Function
Private Sub btnRecycleBin_Click(ByVal sender As Object, ByVal e As EventArgs)
Dim result As DialogResult
result = MessageBox.Show("Are you sure to delete all items in recycle bin", "Empty Recycle bin", MessageBoxButtons.YesNo)
If result = DialogResult.Yes Then
Try
Dim IsSuccess As UInteger = SHEmptyRecycleBin(IntPtr.Zero, Nothing, RecycleFlags.SHRB_NOCONFIRMATION)
MessageBox.Show("Empty the RecycleBin successsfully", "Empty the RecycleBin", MessageBoxButtons.OK, MessageBoxIcon.Information)
Catch ex As Exception
MessageBox.Show("Empty the RecycleBin failed" & ex.Message, "Empty the RecycleBin", MessageBoxButtons.OK, MessageBoxIcon.[Stop])
Application.[Exit]()
End Try
End If
End Sub
End Class

back to topics
Reply
  Hits : 126