用vb.net怎么实现清空垃圾桶的操作呢?想要代码。

来源:百度知道 编辑:UC知道 时间:2024/06/20 04:20:06

enum SHERB
{
SHERB_NOCONFIRMATION = 0x00000001,
SHERB_NOPROGRESSUI = 0x00000002,
SHERB_NOSOUND = 0x00000004
}

[DllImport("shell32.dll", CharSet=CharSet.Auto)]
static extern uint SHEmptyRecycleBin(
IntPtr hwnd,
string pszRootPath,
SHERB dwFlags);

/// <example>
/// Empty(@"c:\"); //清空C:盘的回收站
/// </example>
private static void Empty(string path)
{
SHEmptyRecycleBin(IntPtr.Zero, path, SHERB.SHERB_NOCONFIRMATION );
}