清空回收站
/// <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 }