How to Empty your Recycle Bin via C# Appliation with WindowsDialog

Recycle Bin via C# Appliation

This code will delete the objects from Recycle Bin and it will show Windows
Confirmation Dialog wheather to delete or Not. Confirmation
Copy this code below class.

enum RecyleFlags :uint
SHERB_NOSOUND = 0x00000004
[DllImport("Shell32.dll", CharSet = CharSet.Unicode)]
static extern uint SHEmptyRecycleBin(IntPtr hwnd,string

pszRootPath,RecyleFlags dwFlags);

Now use thie code in your button

uint result = SHEmptyRecycleBin(IntPtr.Zero, null, 0);
label1.Text = result.ToString();


No responses found. Be the first to comment...

  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name: