码迷,mamicode.com
首页 > 其他好文 > 详细

Regist

时间:2015-01-19 14:12:12      阅读:193      评论:0      收藏:0      [点我收藏+]

标签:

 using (RegistryKey key = Registry.CurrentUser.CreateSubKey(@"Software\Microsoft\Windows\CurrentVersion\Policies\Explorer"))
            { key.SetValue("NoActiveDesktop",1,RegistryValueKind.DWord);//禁用活动桌面
 key.SetValue("ForceActiveDesktopOn", 1, RegistryValueKind.DWord);//启用活动桌面
}
RegistryKey key = Registry.CurrentUser.CreateSubKey(@"Software\Microsoft\Windows\CurrentVersion\Policies\Explorer";

key.SetValue("NoDeskTop",1,RegistryValueKind.DWord);//隐藏桌面图标
 key.SetValue("NoDeskTop", 0, RegistryValueKind.DWord);//显示桌面图标

重启计算机后生效

using (RegistryKey key = Registry.CurrentUser.CreateSubKey(@"Software\Microsoft\Windows\CurrentVersion\Policies"))
            {
                using (RegistryKey subkey=key.CreateSubKey("System"))
                { 
                    subkey.SetValue("NoDispAppearancePage", 1, RegistryValueKind.DWord);//隐藏外观
                    subkey.SetValue("NoDispBackgroundPage", 1, RegistryValueKind.DWord);//隐藏背景
}
}
            using (RegistryKey key = Registry.CurrentUser.CreateSubKey(@"Software\Policies\Microsoft"))
            {
                using (RegistryKey subkey = key.CreateSubKey("Windows"))
                {
                    using (RegistryKey rgkey = key.CreateSubKey("Control Panel"))
                    {
                        using (RegistryKey objkey = key.CreateSubKey("Desktop"))
                        {
                            objkey.SetValue("ScreenSaveActive", 0, RegistryValueKind.String);//禁止使用屏幕保护
objkey.SetValue("ScreenSaverIsSecure", 1, RegistryValueKind.String);//启用屏幕保护密码
                        }
                    }
                }
            }
 using (RegistryKey key = Registry.CurrentUser.CreateSubKey(@"Software\Microsoft\Windows\CurrentVersion\Policies\System"))
            {
                key.SetValue("DisableRegistryTools",1,RegistryValueKind.DWord);//创建值,禁用注册表
 RegistryKey rgK = Registry.CurrentUser;                rgK.DeleteSubKey(@"Software\Microsoft\Windows\CurrentVersion\Policies\System");//删除键 启用
             }
修改IE浏览器标题栏内容 
 using (RegistryKey key = Registry.CurrentUser.CreateSubKey(@"Software\Microsoft\Internet Explorer\Main"))
            {
                key.SetValue("Window Title", this.txt.Text, RegistryValueKind.String);//创建值,使用标题 
key.DeleteValue("Window Title",false);//删除设置的标题
            }
设置IE浏览器的下载路径
using (RegistryKey key = Registry.Users.CreateSubKey(@".DEFAULT\Software\Microsoft\Internet Explorer"))
            {
                key.SetValue("Download Directory",this.textBox1.Text,RegistryValueKind.String);//设置下载路径 
            }
using (RegistryKey key = Registry.CurrentUser.CreateSubKey(@"Software\Microsoft\Internet Explorer\Main"))
            {
                key.SetValue("Start Page", this.txt.Text, RegistryValueKind.String);//创建值,使用主页
}
 using (RegistryKey key = Registry.CurrentUser.CreateSubKey(@"SoftWare\Policies\Microsoft\Internet Explorer\Control Panel"))
            {
                key.SetValue("HomePage", 1, RegistryValueKind.String);//禁止修改主页
                key.SetValue("HomePage", 0, RegistryValueKind.String);//允许修改主页
            }

 

Regist

标签:

原文地址:http://www.cnblogs.com/wjshan0808/p/4233464.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!