C#完成清空收受接管站的辦法。本站提示廣大學習愛好者:(C#完成清空收受接管站的辦法)文章只能為提供參考,不一定能成為您想要的結果。以下是C#完成清空收受接管站的辦法正文
本文實例講述了C#完成清空收受接管站的辦法。分享給年夜家供年夜家參考。詳細完成辦法以下:
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Runtime.InteropServices; namespace App { class ClearRecycle { [DllImportAttribute("shell32.dll")] private static extern int SHEmptyRecycleBin(IntPtr handle, string root, int falgs); const int SHERB_NOCONFIRMATION = 0x000001; const int SHERB_NOPROGRESSUI = 0x000002; const int SHERB_NOSOUND = 0x000004; /// <summary> /// 清空收受接管站 /// </summary> /// <param name="tip">能否提醒</param> /// <param name="form">以後窗體,普通傳入this</param> public static void Clear(bool tip, System.Windows.Forms.Form form) { System.Windows.Forms.DialogResult result = System.Windows.Forms.DialogResult.No; if (tip) result = System.Windows.Forms.MessageBox.Show("肯定要清空收受接管站嗎?", "友誼提醒", System.Windows.Forms.MessageBoxButtons.YesNo, System.Windows.Forms.MessageBoxIcon.Information); else result = System.Windows.Forms.DialogResult.Yes; if (result == System.Windows.Forms.DialogResult.Yes) { SHEmptyRecycleBin(form.Handle, "", SHERB_NOCONFIRMATION + SHERB_NOPROGRESSUI + SHERB_NOSOUND); } } } }
願望本文所述對年夜家的C#法式設計有所贊助。