国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > C# > 正文

C#實(shí)現(xiàn)清空回收站的方法

2019-10-29 21:39:13
字體:
供稿:網(wǎng)友

這篇文章主要介紹了C#實(shí)現(xiàn)清空回收站的方法,涉及C#系統(tǒng)回收站的清空技巧,非常簡單實(shí)用,具有一定參考借鑒價(jià)值,需要的朋友可以參考下

本文實(shí)例講述了C#實(shí)現(xiàn)清空回收站的方法。分享給大家供大家參考。具體實(shí)現(xiàn)方法如下:

 

 
  1. using System; 
  2. using System.Collections.Generic; 
  3. using System.Linq; 
  4. using System.Text; 
  5. using System.Runtime.InteropServices; 
  6. namespace App 
  7. class ClearRecycle 
  8. [DllImportAttribute("shell32.dll")] 
  9. private static extern int SHEmptyRecycleBin(IntPtr handle, string root, int falgs); 
  10. const int SHERB_NOCONFIRMATION = 0x000001; 
  11. const int SHERB_NOPROGRESSUI = 0x000002; 
  12. const int SHERB_NOSOUND = 0x000004; 
  13. /// <summary> 
  14. /// 清空回收站 
  15. /// </summary> 
  16. /// <param name="tip">是否提示</param> 
  17. /// <param name="form">當(dāng)前窗體,一般傳入this</param> 
  18. public static void Clear(bool tip, System.Windows.Forms.Form form) 
  19. System.Windows.Forms.DialogResult result = System.Windows.Forms.DialogResult.No; 
  20. if (tip) 
  21. result = System.Windows.Forms.MessageBox.Show("確定要清空回收站嗎?""友情提示", System.Windows.Forms.MessageBoxButtons.YesNo, System.Windows.Forms.MessageBoxIcon.Information); 
  22. else 
  23. result = System.Windows.Forms.DialogResult.Yes; 
  24. if (result == System.Windows.Forms.DialogResult.Yes) 
  25. SHEmptyRecycleBin(form.Handle, "", SHERB_NOCONFIRMATION + SHERB_NOPROGRESSUI + SHERB_NOSOUND); 

希望本文所述對大家的C#程序設(shè)計(jì)有所幫助。

發(fā)表評論 共有條評論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 哈巴河县| 奇台县| 灵丘县| 平阳县| 修文县| 土默特右旗| 九龙城区| 四川省| 教育| 兴宁市| 定兴县| 三穗县| 溆浦县| 龙陵县| 铜陵市| 武乡县| 望谟县| 缙云县| 衡东县| 清徐县| 临沂市| 杭州市| 南充市| 唐山市| 庆元县| 江源县| 肥城市| 增城市| 临桂县| 神农架林区| 溧水县| 行唐县| 南溪县| 兰溪市| 青浦区| 金寨县| 墨竹工卡县| 阆中市| 鹿邑县| 永清县| 沁源县|