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_NOCONFIRMATION = 0x00000001,
SHERB_NPROGRESSUI = 0x00000002,
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();


Comments

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:
    Email: