读取注册列表信息,碰到读取数字与地址符相结合的注册列表键名
我怀疑是该键名非字符串类型造成无法读取
但是如果我直接使用字符串的连接的方式却可以直接取出相对的数据 RegistryKey Key = null; ArrayList arrayList = new ArrayList(); try
{
//HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\DISPLAY\HWP2807\5&19f89766&0&11335588&01&00\Device Parameters
string Monitor = "SYSTEM\\CurrentControlSet\\Enum\\DISPLAY";
//打开注册列表卸载选项
//SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall
Key = Registry.LocalMachine.OpenSubKey(Monitor);
if (Key != null)
{
foreach (String MonitorKeyName in Key.GetSubKeyNames())
{
if (MonitorKeyName != "Default_Monitor")
{
Console.WriteLine("MonitorKey:" + MonitorKeyName); //打开对应的
RegistryKey MonitorKey = Registry.LocalMachine.OpenSubKey(Monitor + "\\" + MonitorKeyName); foreach (String keyname in MonitorKey.GetValueNames())
{
//这里无法获取到下面的数字与地址符组合的键名称
string KeyName = @"5&19f89766&0&11335588&01&00";
arrayList.Add("keyName:" + KeyName);
//keyName like 5&19f89766&0&11335588&01&00
Console.WriteLine("keyName:" + KeyName); RegistryKey EDIDKey = MonitorKey.OpenSubKey(KeyName + "\\Device Parameters");
if (EDIDKey != null)
{
arrayList.Add("EDIDKey:" + EDIDKey.ToString());
String EDID = EDIDKey.GetValue("EDID", "Nothing").ToString();
if (EDID != "Nothing")
{
arrayList.Add(EDID);
}
}// if EDID key not null
}
}//if subkey name not "Default_Monitor"
}
}//if key not null
}
希望熟悉注册列表的朋友帮忙解答下
我怀疑是该键名非字符串类型造成无法读取
但是如果我直接使用字符串的连接的方式却可以直接取出相对的数据 RegistryKey Key = null; ArrayList arrayList = new ArrayList(); try
{
//HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\DISPLAY\HWP2807\5&19f89766&0&11335588&01&00\Device Parameters
string Monitor = "SYSTEM\\CurrentControlSet\\Enum\\DISPLAY";
//打开注册列表卸载选项
//SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall
Key = Registry.LocalMachine.OpenSubKey(Monitor);
if (Key != null)
{
foreach (String MonitorKeyName in Key.GetSubKeyNames())
{
if (MonitorKeyName != "Default_Monitor")
{
Console.WriteLine("MonitorKey:" + MonitorKeyName); //打开对应的
RegistryKey MonitorKey = Registry.LocalMachine.OpenSubKey(Monitor + "\\" + MonitorKeyName); foreach (String keyname in MonitorKey.GetValueNames())
{
//这里无法获取到下面的数字与地址符组合的键名称
string KeyName = @"5&19f89766&0&11335588&01&00";
arrayList.Add("keyName:" + KeyName);
//keyName like 5&19f89766&0&11335588&01&00
Console.WriteLine("keyName:" + KeyName); RegistryKey EDIDKey = MonitorKey.OpenSubKey(KeyName + "\\Device Parameters");
if (EDIDKey != null)
{
arrayList.Add("EDIDKey:" + EDIDKey.ToString());
String EDID = EDIDKey.GetValue("EDID", "Nothing").ToString();
if (EDID != "Nothing")
{
arrayList.Add(EDID);
}
}// if EDID key not null
}
}//if subkey name not "Default_Monitor"
}
}//if key not null
}
希望熟悉注册列表的朋友帮忙解答下
解决方案 »
- 安装sql 2008 express advanced版问题
- LumiSoft.Net.IMAP收邮件问题
- 免费邮件群发系统(多线程版)(含Source可下载)
- 怎样对这段文本进行加密
- C#调用一个EXE软件安装,就出现如下问题。请帮忙
- 怎么直接下载txt文件,而不是在IE中打开?
- 关于Form上的CancelButton属性
- 急需Visual Studio .NET 2003 简体中文版中Library CD3 里的一个文件,有的请发给我
- 再散100分!终于离开软件行业了,散分给还在里面挣扎的朋友们!
- 关于VS2013 逻辑判断偷懒的疑问。
- DataGridView的CheckBox列全选问题
- 关于线程池的初级若干问题!!
// foreach (String keyname in MonitorKey.GetValueNames())
// 应该是 GetSubKeyNamesstring MONITORs = "SYSTEM\\CurrentControlSet\\Enum\\DISPLAY";using (RegistryKey DISPLAY = Registry.LocalMachine.OpenSubKey(MONITORs))
{
if (DISPLAY == null) return; foreach (string name in DISPLAY.GetSubKeyNames())
{
if (name == "Default_Monitor") continue; Console.WriteLine("{0}", name); using (RegistryKey SN = DISPLAY.OpenSubKey(name))
{
if (SN == null) continue; foreach (string number in SN.GetSubKeyNames())
{
Console.WriteLine("\t{0}", number); using (RegistryKey PARAM = SN.OpenSubKey(number + "\\Device Parameters"))
{
if (PARAM == null) continue; object EDID = PARAM.GetValue("EDID"); if (EDID != null)
{
Console.WriteLine("\t\t{0}", BitConverter.ToString(EDID as byte[]));
}
}
}
}
}
}