Домой Windows Очистка корзины Windows: Справочник по C#

Очистка корзины Windows: Справочник по C#

613
0


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;

enum RecycleFlags : int
{
// No confirmation dialog when emptying the recycle bin
SHERB_NOCONFIRMATION = 0x00000001,
// No progress tracking window during the emptying of the recycle bin
SHERB_NOPROGRESSUI = 0x00000001,
// No sound whent the emptying of the recycle bin is complete
SHERB_NOSOUND = 0x00000004
}

namespace EmptyRecycleBin
{
public partial class Form1 : Form
{
// Shell32.dll is where SHEmptyRecycleBin is located
[DllImport("Shell32.dll")]
// The signature of SHEmptyRecycleBin (located in Shell32.dll)
static extern int SHEmptyRecycleBin(IntPtr hwnd, string pszRootPath, RecycleFlags dwFlags);

public Form1()
{
InitializeComponent();
}

private void btnEmpty_Click(object sender, EventArgs e)
{
// Call the function that empties the recycle bin
SHEmptyRecycleBin(IntPtr.Zero, null, RecycleFlags.SHERB_NOSOUND | RecycleFlags.SHERB_NOCONFIRMATION);
}
}
}

Очистка корзины Windows: Справочник по C#

0.00 (0%) 0 votes

ЧИТАТЬ ТАКЖЕ:  Блокировка ctrl-alt-delete, alt-tab, Пуск и других сочетаний клавиш: Справочник по C#

ОСТАВЬТЕ ОТВЕТ

Пожалуйста, введите ваш комментарий!
пожалуйста, введите ваше имя здесь