• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
wjshan0808

Learn from yesterday, Live for today, For a better tomorrow.
 ————wjshan0808

博客园    首页    新随笔    联系   管理    订阅  订阅

清空回收站

/// <summary>
        /// Empties the Recycle Bin on the specified drive.
        /// </summary>
        /// <param name="hwnd">A handle to the parent window of any dialog boxes that might be displayed during the operation. This parameter can be NULL.</param>
        /// <param name="pszRootPath">The address of a null-terminated string of maximum length MAX_PATH that contains the path of the root drive on which the Recycle Bin is located. This parameter can contain the address of a string formatted with the drive, folder, and subfolder names, for example c:\windows\system\. It can also contain an empty string or NULL. If this value is an empty string or NULL, all Recycle Bins on all drives will be emptied.</param>
        /// <param name="dwFlags">SHERB</param>
        /// <returns>If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.</returns>
        [DllImport("shell32.dll")]
        private static extern int SHEmptyRecycleBin(IntPtr hwnd, string pszRootPath, SHERB dwFlags);

 public enum SHERB:int
    { 
        /// <summary>
        /// No dialog box confirming the deletion of the objects will be displayed.
        /// </summary>
        SHERB_NOCONFIRMATION =1,
        /// <summary>
        /// No dialog box indicating the progress will be displayed.
        /// </summary>
        SHERB_NOPROGRESSUI=2,
        /// <summary>
        /// No sound will be played when the operation is complete.
        /// </summary>
        SHERB_NOSOUND =4 
    }

 


posted @ 2015-01-19 14:44  wjshan0808  阅读(139)  评论(0)    收藏  举报
刷新页面返回顶部
博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3