安装了CorelDraw,无法从注册表获得已安装了CorelDraw的displayname信息
用什么方法才能获取,用下面的方法无获取:
public String[] SoftwareList()
{ String[] softwareList = null; //动态数组
ArrayList list = new ArrayList();
try
{ //打开注册列表卸载选项
RegistryKey Key = Microsoft.Win32.Registry.LocalMachine.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall");
if (Key != null)//如果系统禁止访问则返回null
{ foreach (String SubKeyName in Key.GetSubKeyNames()) { //打开对应的软件名称
RegistryKey SubKey = Key.OpenSubKey(SubKeyName);
if (SubKey != null)
{ String SoftwareName = SubKey.GetValue("DisplayName", "Nothing").ToString(); //如果没有取到,则不存入动态数组
if (SoftwareName != "Nothing")
{ list.Add(SoftwareName); } }
} //强制转换成字符串数组,防止被修改数据溢出
softwareList = (string[])list.ToArray(typeof(string));
}
} catch (Exception err)
{ Console.WriteLine("出错信息:" + err.ToString()); } return softwareList;
}