自强不息,止于至善

身无半文,心忧天下;手释万卷,神交古人
  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

注册表操作

Posted on 2007-10-16 14:58  L.Zhang  阅读(140)  评论(0)    收藏  举报
using Microsoft.Win32; 

//写入
RegistryKey softwareKey = Registry.LocalMachine.OpenSubKey("Software"true);
RegistryKey myKey 
= softwareKey.CreateSubKey("myKey");
myKey.SetValue(
"key1", (object)"value1");

//读取
RegistryKey softwareKey = Registry.LocalMachine.OpenSubKey("Software");
RegistryKey myKey 
= softwareKey.OpenSubKey("myKey");
string strValue = (string)myKey.GetValue("key1");