c#注册表问题

来源:百度知道 编辑:UC知道 时间:2024/05/16 14:17:49
using System;
using Microsoft.Win32;
class ShowRegistry
{
public static int Main(string[] args)
{
RegistryKey user = Registry.CurrentUser;
RegistryKey software = user.OpenSubKey("software");
RegistryKey microsoft = software.OpenSubKey("microsoft");
RegistryKey IE = microsoft.OpenSubKey("Internet Explorer");
RegistryKey url = IE.OpenSubKey("TypedURLs");
long lCount = url.ValueCount;
if(lCount<= 0)
return 1;
string[] urlArray = url.GetValueNames();
Console.WriteLine("yYou have typed in following web sites in IE:");
int i = 1;
foreach(string URL in urlArray)
{
Console.WriteLine("[{0}]{1}",i,url.GetValue(URL));
}
Console.Read();
}

}
我想问的是1.RegistryKey user = Registry.CurrentUser;
RegistryKey software = user.OpenSubKey("software");
("software")是规定的必须

RegistryKey software = user.OpenSubKey("software");
第一个software是变量名,随便起,后面一个software是注册表里的一个目录的名字,不能随便该。
GetSubKeyNames 检索包含所有子项名称的字符串数组。
ValueCount 检索项中值的计数。

msdn找的,不懂再去msnd看看例子。

这问题MSDN没答案吗