Emtpy recyble bin in C#
ctg | 13 Noviembre, 2007 00:41On 2006, I wrote a post to send a file to Recycle Bin. But, at the same, I need a code to empty recycle bin. Here is the code:
using System.Runtime.InteropServices;
enum RecycleFlags : uint
{
SHERB_NOCONFIRMATION = 0x00000001,
SHERB_NOPROGRESSUI = 0x00000002,
SHERB_NOSOUND = 0x00000004
}
[DllImport("Shell32.dll", CharSet = CharSet.Unicode)]
static extern uint SHEmptyRecycleBin
(IntPtr hwnd,
string pszRootPath,
RecycleFlags dwFlags);
public static void Main()
{
uint result = SHEmptyRecycleBin (IntPtr.Zero, null, 0);
Console.WriteLine ("Result: {0}", result);
}
Posted in
C# .
Comentario: (0).
Retroenlaces:(0).
Enlace
«Next post |
Previous post»