您好,欢迎光临本网站![请登录][注册会员]  
文件名称: using System;using System;using System;
  所属分类: 其它
  开发工具:
  文件大小: 368kb
  下载次数: 0
  上传时间: 2010-05-23
  提 供 者: kingz******
 详细说明: using System; using System.IO; using System.Text.RegularExpressions; using System.Windows.Forms; using Microsoft.Win32; namespace MRU { public partial class FormMRU : Form { public FormMRU() { #region InitializeComponent(); ListView listViewMRU = new ListView(); listViewMRU.Dock = DockStyle.Fill; listViewMRU.HeaderStyle = ColumnHeaderStyle.None; // 隐藏列标题。 listViewMRU.View = View.Details; // 详细信息。 listViewMRU.CheckBoxes = true; // 显示复选框。 listViewMRU.Scrollable = false; // 隐藏滚动条。 listViewMRU.ShowGroups = true; // 分组显示项。 listViewMRU.BeginUpdate(); ListViewGroup pro = listViewMRU.Groups.Add("profile", "profile"); listViewMRU.Items.Add(Environment.GetFolderPath(Environment.SpecialFolder.Recent)).Group = pro; listViewMRU.Items.Add(Environment.GetFolderPath(Environment.SpecialFolder.Cookies)).Group = pro; listViewMRU.Items.Add(Path.GetTempPath()).Group = pro; listViewMRU.Items.Add(Environment.GetFolderPath(Environment.SpecialFolder.History)).Group = pro; listViewMRU.Items.Add(Environment.GetFolderPath(Environment.SpecialFolder.InternetCache)).Group = pro; ListViewGroup reg = listViewMRU.Groups.Add("regedit", "regedit"); listViewMRU.Items.Add(@"HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\TypedURLs").Group = reg; listViewMRU.Items.Add(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\RunMRU").Group = reg; listViewMRU.Items.Add(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\ComDlg32").Group = reg; listViewMRU.Items.Add(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Applets\Paint").Group = reg; listViewMRU.Items.Add(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Applets\Wordpad").Group = reg; ColumnHeader column = listViewMRU.Columns.Add(""); column.AutoResize(ColumnHeaderAutoResizeStyle.ColumnContent); // 自动调整列宽。 listViewMRU.EndUpdate(); listViewMRU.ItemChecked += new ItemCheckedEventHandler(listViewMRU_ItemChecked); this.Controls.Add(listViewMRU); this.ClientSize = new System.Drawing.Size(column.Width + 8, 260); this.Text = Environment.UserName; this.AutoSizeMode = AutoSizeMode.GrowAndShrink; // 禁用手动调整大小。 this.SizeGripStyle = SizeGripStyle.Hide; // 隐藏调整大小手柄。 this.StartPosition = FormStartPosition.CenterScreen; // 在桌面居中显示。 #endregion } #region ListView_ItemChecked private void listViewMRU_ItemChecked(object sender, ItemCheckedEventArgs e) { if (!e.Item.Checked) return; DirectoryInfo dir = new DirectoryInfo(e.Item.Text); switch (e.Item.Index) { case 0: case 1: foreach (FileInfo info in dir.GetFiles()) { if (Regex.IsMatch(info.Extension, @".(dat|ini)", RegexOptions.IgnoreCase)) // 指定不区分大小写的匹配。 continue; this.Text = info.Name; info.Delete(); } break; case 2: foreach (FileSystemInfo info in dir.GetFileSystemInfos()) { try { if (info is FileInfo) info.Delete(); else (info as DirectoryInfo).Delete(true); } catch { continue; } finally { this.Text = info.Name; } } break; case 3: System.Diagnostics.Process.Start(e.Item.Text); break; case 4: foreach (FileInfo info in dir.GetFiles("*.*", SearchOption.AllDirectories)) { if (Regex.IsMatch(info.Extension, @".(dat|ini)", RegexOptions.IgnoreCase)) // 指定不区分大小写的匹配。 continue; try { info.Delete(); } catch { continue; } finally { this.Text = info.Name; } } break; case 5: using (RegistryKey subKey = Registry.CurrentUser.CreateSubKey(@"Software\Microsoft\Internet Explorer\TypedURLs")) { foreach (string mru in subKey.GetValueNames()) { subKey.DeleteValue(mru); } } break; case 6: using (RegistryKey subKey = Registry.CurrentUser.CreateSubKey(@"Software\Microsoft\Windows\CurrentVersion\Explorer\RunMRU")) { foreach (string mru in subKey.GetValueNames()) { subKey.DeleteValue(mru); } } break; case 7: using (RegistryKey subKey = Registry.CurrentUser.CreateSubKey(@"Software\Microsoft\Windows\CurrentVersion\Explorer\ComDlg32")) { foreach (string mru in subKey.GetSubKeyNames()) { subKey.DeleteSubKeyTree(mru); } } break; case 8: using (RegistryKey subKey = Registry.CurrentUser.CreateSubKey(@"Software\Microsoft\Windows\CurrentVersion\Applets\Paint\Recent File List")) { foreach (string mru in subKey.GetValueNames()) { subKey.DeleteValue(mru); } } break; case 9: using (RegistryKey subKey = Registry.CurrentUser.CreateSubKey(@"Software\Microsoft\Windows\CurrentVersion\Applets\Wordpad\Recent File List")) { foreach (string mru in subKey.GetValueNames()) { subKey.DeleteValue(mru); } } break; } this.Text = Environment.UserName; } #endregion } }using System; using System.IO; using System.Text.RegularExpressions; using System.Windows.Forms; using Microsoft.Win32; namespace MRU { public partial class FormMRU : Form { public FormMRU() { #region InitializeComponent(); ListView listViewMRU = new ListView(); listViewMRU.Dock = DockStyle.Fill; listViewMRU.HeaderStyle = ColumnHeaderStyle.None; // 隐藏列标题。 listViewMRU.View = View.Details; // 详细信息。 listViewMRU.CheckBoxes = true; // 显示复选框。 listViewMRU.Scrollable = false; // 隐藏滚动条。 listViewMRU.ShowGroups = true; // 分组显示项。 listViewMRU.BeginUpdate(); ListViewGroup pro = listViewMRU.Groups.Add("profile", "profile"); listViewMRU.Items.Add(Environment.GetFolderPath(Environment.SpecialFolder.Recent)).Group = pro; listViewMRU.Items.Add(Environment.GetFolderPath(Environment.SpecialFolder.Cookies)).Group = pro; listViewMRU.Items.Add(Path.GetTempPath()).Group = pro; listViewMRU.Items.Add(Environment.GetFolderPath(Environment.SpecialFolder.History)).Group = pro; listViewMRU.Items.Add(Environment.GetFolderPath(Environment.SpecialFolder.InternetCache)).Group = pro; ListViewGroup reg = listViewMRU.Groups.Add("regedit", "regedit"); listViewMRU.Items.Add(@"HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\TypedURLs").Group = reg; listViewMRU.Items.Add(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\RunMRU").Group = reg; listViewMRU.Items.Add(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\ComDlg32").Group = reg; listViewMRU.Items.Add(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Applets\Paint").Group = reg; listViewMRU.Items.Add(@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Applets\Wordpad").Group = reg; ColumnHeader column = listViewMRU.Columns.Add(""); column.AutoResize(ColumnHeaderAutoResizeStyle.ColumnContent); // 自动调整列宽。 listViewMRU.EndUpdate(); listViewMRU.ItemChecked += new ItemCheckedEventHandler(listViewMRU_ItemChecked); this.Controls.Add(listViewMRU); this.ClientSize = new System.Drawing.Size(column.Width + 8, 260); this.Text = Environment.UserName; this.AutoSizeMode = AutoSizeMode.GrowAndShrink; // 禁用手动调整大小。 this.SizeGripStyle = SizeGripStyle.Hide; // 隐藏调整大小手柄。 this.StartPosition = FormStartPosition.CenterScreen; // 在桌面居中显示。 #endregion } #region ListView_ItemChecked private void listViewMRU_ItemChecked(object sender, ItemCheckedEventArgs e) { if (!e.Item.Checked) return; DirectoryInfo dir = new DirectoryInfo(e.Item.Text); switch (e.Item.Index) { case 0: case 1: foreach (FileInfo info in dir.GetFiles()) { if (Regex.IsMatch(info.Extension, @".(dat|ini)", RegexOptions.IgnoreCase)) // 指定不区分大小写的匹配。 continue; this.Text = info.Name; info.Delete(); } break; case 2: foreach (FileSystemInfo info in dir.GetFileSystemInfos()) { try { if (info is FileInfo) info.Delete(); else (info as DirectoryInfo).Delete(true); } catch { continue; } finally { this.Text = info.Name; } } break; case 3: System.Diagnostics.Process.Start(e.Item.Text); break; case 4: foreach (FileInfo info in dir.GetFiles("*.*", SearchOption.AllDirectories)) { if (Regex.IsMatch(info.Extension, @".(dat|ini)", RegexOptions.IgnoreCase)) // 指定不区分大小写的匹配。 continue; try { info.Delete(); } catch { continue; } finally { this.Text = info.Name; } } break; case 5: using (RegistryKey subKey = Registry.CurrentUser.CreateSubKey(@"Software\Microsoft\Internet Explorer\TypedURLs")) { foreach (string mru in subKey.GetValueNames()) { subKey.DeleteValue(mru); } } break; case 6: using (RegistryKey subKey = Registry.CurrentUser.CreateSubKey(@"Software\Microsoft\Windows\CurrentVersion\Explorer\RunMRU")) { foreach (string mru in subKey.GetValueNames()) { subKey.DeleteValue(mru); } } break; case 7: using (RegistryKey subKey = Registry.CurrentUser.CreateSubKey(@"Software\Microsoft\Windows\CurrentVersion\Explorer\ComDlg32")) { foreach (string mru in subKey.GetSubKeyNames()) { subKey.DeleteSubKeyTree(mru); } } break; case 8: using (RegistryKey subKey = Registry.CurrentUser.CreateSubKey(@"Software\Microsoft\Windows\CurrentVersion\Applets\Paint\Recent File List")) { foreach (string mru in subKey.GetValueNames()) { subKey.DeleteValue(mru); } } break; case 9: using (RegistryKey subKey = Registry.CurrentUser.CreateSubKey(@"Software\Microsoft\Windows\CurrentVersion\Applets\Wordpad\Recent File List")) { foreach (string mru in subKey.GetValueNames()) { subKey.DeleteValue(mru); } } break; } this.Text = Environment.UserName; } #endregion } } ...展开收缩
(系统自动生成,下载前可以参看下载内容)

下载文件列表

相关说明

  • 本站资源为会员上传分享交流与学习,如有侵犯您的权益,请联系我们删除.
  • 本站是交换下载平台,提供交流渠道,下载内容来自于网络,除下载问题外,其它问题请自行百度
  • 本站已设置防盗链,请勿用迅雷、QQ旋风等多线程下载软件下载资源,下载后用WinRAR最新版进行解压.
  • 如果您发现内容无法下载,请稍后再次尝试;或者到消费记录里找到下载记录反馈给我们.
  • 下载后发现下载的内容跟说明不相乎,请到消费记录里找到下载记录反馈给我们,经确认后退回积分.
  • 如下载前有疑问,可以通过点击"提供者"的名字,查看对方的联系方式,联系对方咨询.
 输入关键字,在本站1000多万海量源码库中尽情搜索: