注册表的读写问题
来源:互联网 发布:天涯营销软件 编辑:程序博客网 时间:2024/05/22 12:43
要操作注册表,我们必须要引入必要的命名空间:using Microsoft.Win32;
(1)读注册表
object displayName = null, displayVersion = null; RegistryKey currentKey = null; RegistryKey pregkey = Registry.LocalMachine.OpenSubKey(@"XXXXXXXX");//获取指定路径下的键 try { foreach (string item in pregkey.GetSubKeyNames()) //循环所有子键 { currentKey = pregkey.OpenSubKey(item); displayName = currentKey.GetValue("DisplayName"); //获取显示名称 displayVersion = currentKey.GetValue("DisplayVersion"); //获取卸载字符串路径 //其他操作··············· } } catch (Exception E) { MessageBox.Show(E.Message.ToString()); }(2)写注册表
RegistryKey local_internet = Registry.CurrentUser.OpenSubKey(@"XXXXXXX", true);//获取指定路径下的键 修改权限 try { //1提示 3禁用 下载已签名的 ActiveX 控件 local_internet.SetValue("1001", 0);//其他操作······································ } catch (Exception E) { MessageBox.Show(E.Message.ToString()); }
其中需要注意的是,有些注册表的操作关系到权限的问题,这时候需要使用
CurrentUser.OpenSubKey(@"XXXXXXX", true); 这样的方法获取权限
- 注册表的读写问题
- 关于读写注册表二进制数据的问题
- 关于Windows7 64的注册表读写问题
- C++ 注册表的读写
- 读写注册表的封装
- 读写注册表的函数
- 注册表的读写
- C#注册表的读写
- 注册表类的读写操作
- 读写注册表的自定义函数
- 配置文件与注册表的读写
- (C++)读写注册表的类
- 简单的读写注册表实例
- Windows读写注册表的例子
- 读写注册表
- 读写注册表
- 读写注册表
- 读写注册表
- 运用Jconsole监控JVM
- (csdn内转载)使用ControllerClassNameHandlerMapping实现SpringMVC的CoC配置
- tempdb对SQL Server数据库性能有什么样的影响
- 继续编译2
- Eclipse里repository location的删除
- 注册表的读写问题
- 关于C++和C
- Apache对域名的泛解析方法集锦
- unrar
- Tomcat下配置CAS,SSL
- 用 badblocks 检测硬盘坏道
- Eclipse 部分快捷键
- hadoop从节点cpu100%以上
- linux嵌入式系统开发之看门狗----应用篇。