C#读写注册表
2007-11-30 19:55
351 查看
using Microsoft.Win32 ;
using System;
using Microsoft.Win32 ;
namespace ybsys
...{
/**//// <summary>
///注册表操作
/// </summary>
public class EditRegedit
...{
public EditRegedit()
...{
}
/**//// <summary>
/// 写注册表
/// </summary>
public void writeReg()
...{
RegistryKey rkey = Registry.LocalMachine;
//The second parameter tells it to open the key as writable
RegistryKey rkey1 = rkey.OpenSubKey("Software",true);
RegistryKey rkey2 = rkey1.CreateSubKey("WindowWinSys");
rkey2.SetValue("winyb","2007-8-9");
rkey2.Close();
rkey1.Close();
}
/**//// <summary>
/// 读注册表
/// </summary>
/// <returns></returns>
public string readReg()
...{
RegistryKey rkey = Registry.LocalMachine;
//The second parameter tells it to open the key as writable
RegistryKey rkey1 = rkey.OpenSubKey("Software/baoTest",true);
//rkey1.GetValue("Name")
if(rkey1==null||rkey1.GetValue("Name")==null)
...{
return "";
}
else
...{
return rkey1.GetValue("Name").ToString();
}
}
}
}
相关文章推荐
- 【VS调试】C#读写Windows 7注册表时抛出“不允许所请求的注册表访问权”的解决办法
- C#对注册表读写类的再封装
- Operating the registry help class(C#读写注册表操作)
- 服务程序C#编写系统服务,注册表读写问题
- C#读写注册表
- C#读写注册表
- C#读写注册表
- C#读写注册表
- 【VS调试】C#读写Windows 7注册表时抛出“不允许所请求的注册表访问权”的解决办法
- C# 读写注册表
- C#中对注册表的操作 读写注册表方法
- C# 32位/64位系统下程序读写注册表之差异
- 【VS调试】C#读写Windows 7注册表时抛出“不允许所请求的注册表访问权”的解决办法
- c# 读写注册表
- 易语言写DLL给C#调用读写注册表
- 【VS调试】C#读写Windows 7注册表时抛出“不允许所请求的注册表访问权”的解决办法
- 如何在C#中读写注册表
- C#对注册表读写类的再封装
- 【VS调试】C#读写Windows 7注册表时抛出“不允许所请求的注册表访问权”的解决办法
- C#读写注册表