Description :
We can empty the recycle bin by using the bellow coding
Step 1
Following Namespace used
using System.Runtime.InteropServices;
Step 2
Create the enum
enum RecycleFlags : uint
{
SHERB_NOCONFIRMATION = 0x00000001,
SHERB_NOPROGRESSUI = 0x00000002,
SHERB_NOSOUND = 0x00000004
}
Step 3
Dll import
[DllImport("Shell32.dll", CharSet = CharSet.Unicode)]
static extern uint SHEmptyRecycleBin
(IntPtr hwnd,
string pszRootPath,
RecycleFlags dwFlags);
Step 4
Following is the code for empty the recyclebin
public static void Main()
{
uint MyResult = SHEmptyRecycleBin (IntPtr.Zero, null, 0);
Console.WriteLine ("Out put: {0}", MyResult);
}
Regard
Prateek
No comments:
Post a Comment