■ 휴지통을 비우는 방법을 보여준다.
▶ 예제 코드 (C#)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
using System; using System.Runtime.InteropServices; /// <summary> /// 휴지통 플래그 /// </summary> public enum RecycleBinFlag : int { /// <summary> /// SHERB_NOCONFIRMATION /// </summary> SHERB_NOCONFIRMATION = 0x00000001, /// <summary> /// SHERB_NOPROGRESSUI /// </summary> SHERB_NOPROGRESSUI = 0x00000002, /// <summary> /// SHERB_NOSOUND /// </summary> SHERB_NOSOUND = 0x00000004 } #region 휴지통 비우기 - SHEmptyRecycleBin(windowHandle, rootPath, recycleBinFlag) /// <summary> /// 휴지통 비우기 /// </summary> /// <param name="windowHandle">윈도우 핸들</param> /// <param name="rootPath">루트 경로</param> /// <param name="recycleBinFlag">휴지통 플래그</param> /// <returns>처리 결과</returns> [DllImport("Shell32.dll")] public static extern int SHEmptyRecycleBin(IntPtr windowHandle, string rootPath, RecycleBinFlag recycleBinFlag); #endregion SHEmptyRecycleBin ( IntPtr.Zero, null, RecycleBinFlag.SHERB_NOCONFIRMATION | RecycleBinFlag.SHERB_NOPROGRESSUI | RecycleBinFlag.SHERB_NOSOUND ); |