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

首頁(yè) > 編程 > C# > 正文

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

2020-01-24 01:30:37
字體:
來(lái)源:轉(zhuǎn)載
供稿:網(wǎng)友

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

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">當(dāng)前窗體,一般傳入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);   }  } }}

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

發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 界首市| 敦化市| 安溪县| 金平| 乌鲁木齐市| 嘉义县| 灌南县| 江门市| 遂平县| 达州市| 军事| 长阳| 大石桥市| 共和县| 汉川市| 江门市| 正阳县| 花垣县| 盈江县| 永泰县| 开远市| 三门峡市| 滨海县| 平顺县| 贵州省| 潮安县| 安塞县| 桑植县| 利辛县| 北流市| 玛多县| 余干县| 柘城县| 东平县| 洛宁县| 抚远县| 邯郸县| 福鼎市| 吉隆县| 库伦旗| 五莲县|