//读取Windows安装盘目录
//Installation Sources是个REG_MULTI_SZ:多重字串,直接转string读不出
string[] key = (string[])Registry.LocalMachine.OpenSubKey(
@"SOFTWAREMicrosoftWindowsCurrentVersionSetup").GetValue("Installation Sources");
treeView1.Nodes[0].Nodes[4].Nodes[3].Nodes.Add("安装盘目录:" +
key.GetValue(0).ToString());
//读取DirectX版本
//directX是个REG_BINARY类型,必须转换得到它正确的值
byte[] array = (byte[])Registry.LocalMachine.OpenSubKey(
@"SOFTWAREMICROSOFTDirectX").GetValue("InstalledVersion");
//byte array1 = (byte)array.GetValue(0);
string sDirectX = "DirectX ";
for (int i = 0; i < array.Length; i++)
...{
if (array[i] != 0)
...{
sDirectX+=array[i].ToString();
}
}
string sVer= Registry.LocalMachine.OpenSubKey(
@"SOFTWAREMICROSOFTDirectX").GetValue("Version").ToString();
sDirectX += " ("+sVer+")";