hey everyone , we going to learn how to empty the recycle bin using c# this pretty an easy way out . you just need to a button or lets say click event or anything that can do something now you just have to add this codes into your form1 code , i will put whole of my codes here so i am using a button to do the work
here is the codes
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.Runtime.InteropServices; //Author : Mohamed Shimran //Blog : http://www.ultimateprogrammingtutorials.blogspot.com namespace RecycleBin { public partial class Form1 : Form { public Form1() { InitializeComponent(); } enum RecycleFlags : uint { SHERB_NOCONFIRMATION = 0x00000001, SHERB_NOPROGRESSUI = 0x00000001, SHERB_NOSOUND = 0x00000004 } [DllImport("Shell32.dll", CharSet = CharSet.Unicode)] static extern uint SHEmptyRecycleBin(IntPtr hwnd, string pszRootPath, RecycleFlags dwFlags); private void button1_Click(object sender, EventArgs e) { uint result = SHEmptyRecycleBin(IntPtr.Zero, null, 0); } } }enjoy
1 comments:
SHERB_NOPROGRESSUI should be 0x00000002
ReplyIt looks fine by the way.
Post a Comment
Note: Only a member of this blog may post a comment.