实现效果:

  清空回收站_父窗口

知识运用:

  API函数 SHEmptyRecycleBin(IntPtr handle ,string root ,int falgs)

   handle:  父窗口句柄  root: 要清空回收站的地址 为 null时表是全部  falgs: 功能参数

实现代码:

        private const int SHERB_NOCONFIRMATION = 0x000001;      //无确认对话框
        private const int SHERB_NOPROGRESSUI = 0x000002;        //不显示进度
        private const int SHERB_NOSOUND = 0x000004;             //完成不发出声音
        [DllImportAttribute("shell32.dll")]
        private static extern int SHEmptyRecycleBin(IntPtr handle,string root,int falgs);
        private void button1_Click(object sender, EventArgs e)
        {
            SHEmptyRecycleBin(this.Handle,"",SHERB_NOCONFIRMATION+SHERB_NOPROGRESSUI+SHERB_NOSOUND);
        }