All articles| All Pictures| All Softwares| All Video| Go home page| Write articles| Upload pictures

Reading number is top 10 articles
asp.net2.0对Repeater数据控件进行绑定
C#生成中文汉字验证码源码_.net资料_编程技术
asp.net2.0控件DataList实例应用
SQL,Server常见连接错误_[SQL,Server教程]
fastm设计思路深度剖析_php资料_编程技术
.Net中如何操作IIS(源代码)_[Asp.Net教程]
ASP.NET,2.0中使用样式、主题和皮肤_.net资料_编程技术
Windows 下架设 PHP 服务器_[PHP教程]
ASP.NET Remoting体系结构(七)
ASP.NET中备份sqlserver数据库的方法_[Asp.Net教程]
Reading number is top 10 pictures
初吻给了谁?
China telecom 114 spokesman MeiYanXu2
Absolutely shocked. National geographic 50 animal photographys9
Soong ching ling's former residence1
The woman fight much more than men
The world's top ten most beautiful railway station1
中国的十元人民币的秘密
A beautiful girl to bud3
运动的范冰冰2
In the world the most mysterious 21 place landscape3
Download software ranking
1400篇各类破解文章
The Bermuda triangle2
Eclipse 4.2.2 For Win64
Ashlynn Video3
WebService在.NET中的实战应用教学视频 → 第5集
天龙八部十二宫服务端
Proficient in JavaScript
Wild things 2
Boxer vs Yellow4
Boxer's Top ten classic battle7
qq published in(发表于) 2014/7/11 9:28:27 Edit(编辑)
C#教程:通过注册表优化系统

C#教程:通过注册表优化系统

C#教程:通过注册表优化系统

通过注册表优化系统

随着用户为自己的计算机安装很多软件后会明显的发现“开/关”机的速度很慢,右键单击桌面时快捷菜单要等待几秒才能显示,下面通过操作注册表来解决该问题。

本实例通过RegistryKey类与Registry类对注册表中的键值进行写入与删除,实现通过注册表优化系统的功能,其中包括“加快开/关机速度”、“加快自动刷新率”、“加快菜单显示速度”等,程序运行结果如图1所示。

设置注册表中“HKEY_CURRENT_USER Control PanelDesktop”键下的“HungApp Timeout”值为400,将“WaitToKillAppTimeout”键的数值设置为1000,同时再把“HKEY_ LOCAL_ MACHINESystemCurrentControlSetControl”键下“HungAppTimeout”值设置为400,将字符串“WaitToKillServiceTimeout”的数值设置为1000。运行程序,如图15所示,鼠标左键单击【加快开/关机速度】按钮,重新启动计算机后,便可以得到理想的开关机效果。代码如下:

private void button1_Click(object sender, EventArgs e)

{

try

{

RegistryKey rgK = Registry.CurrentUser.CreateSubKey(@"Control PanelDesktop");

rgK.SetValue("HungAppTimeout", 400);

rgK.SetValue("WaitToKillAppTimeout", 1000);

Registry.SetValue(@"HKEY_LOCAL_MACHINESystem CurrentControlSetControl","HungAppTimeout", 400);

Registry.SetValue(@"HKEY_LOCAL_MACHINESystem CurrentControlSetControl", "WaitToKillServiceTimeout", 1000);

MessageBox.Show("修改成功--请重新启动计算机");

}

catch(Exception ey)

{

MessageBox.Show("这个程序可以不适合用户的操作系统");

}

}

为了节约刷新时的等待时间,可以通过设置注册表中的键值(“HKEY_LOCAL_MACHINE SystemCurrentControlSetControlUpdate”,将Dword“UpdateMode”的数值数据更改为“0”这里的值可以根据要求自己设置)实现。运行程序,如图37.15所示,单击【加快自动刷新率】按钮,重新启动计算机后,便可以加快自动刷新率。代码如下:

private void button2_Click(object sender, EventArgs e)

{

try

{

RegistryKey rgK = Registry.LocalMachine.CreateSubKey(@"SystemCurrentControlSetControlUpdate");

rgK.SetValue("UpdateMode", 0);

MessageBox.Show("修改成功--请重新启动计算机");

}

catch (Exception ey)

{

MessageBox.Show("这个程序可以不适合用户的操作系统");

}

}

加快菜单显示速度,可以通过设置注册表中的键值(“HKEY_CURRENT_USERControl PanelDesktop”,将字符串值“MenuShowDelay”的数值数据更改为“0”,调整后如果觉得菜单显示速度太快而不适应,可将“MenuShowDelay”的数值数据更改为“200”)实现。运行程序,如图37.15所示,单击【加快菜单显示速度】按钮,重新启动计算机后,便可以加快菜单的显示速度。代码如下:

private void button3_Click(object sender, EventArgs e)

{

try

{

RegistryKey rgK = Registry.CurrentUser.CreateSubKey(@"ControlPanelDesktop");

rgK.SetValue("MenuShowDelay", 0);//可以弄大些可以看出效果

MessageBox.Show("修改成功--请重新启动计算机");

}

catch (Exception ey)

{

MessageBox.Show("这个程序可以不适合用户的操作系统");

}

完整程序代码如下:

★ ★★★★Form1.cs窗体代码文件完整程序代码★★★★★

using System;

using System.Collections.Generic;

using System.ComponentModel;



添加到del.icio.us 添加到新浪ViVi 添加到百度搜藏 添加到POCO网摘 添加到天天网摘365Key 添加到和讯网摘 添加到天极网摘 添加到黑米书签 添加到QQ书签 添加到雅虎收藏 添加到奇客发现 diigo it 添加到饭否 添加到飞豆订阅 添加到抓虾收藏 添加到鲜果订阅 digg it 貼到funP 添加到有道阅读 Live Favorites 添加到Newsvine 打印本页 用Email发送本页 在Facebook上分享


Disclaimer Privacy Policy About us Site Map

If you have any requirements, please contact webmaster。(如果有什么要求,请联系站长)
Copyright ©2011-
uuhomepage.com, Inc. All rights reserved.