我有这段代码可以获取名称,但是如何获取每个程序的图标?
string SoftwareKey = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\S-1-5-18\\Products";
RegistryKey rk = default(RegistryKey);
rk = Registry.LocalMachine.OpenSubKey(SoftwareKey);
string sname = string.Empty;
foreach (string skname in rk.GetSubKeyNames())
{
try
{
sname = Registry.LocalMachine.OpenSubKey(SoftwareKey).OpenSubKey(skname).OpenSubKey("InstallProperties").GetValue("DisplayName").ToString();
string Inst1 = Registry.LocalMachine.OpenSubKey(SoftwareKey).OpenSubKey(skname).OpenSubKey("InstallProperties").GetValue("InstallLocation").ToString();
int n = dataGridView1.Rows.Add();
dataGridView1.Rows[n].Cells[2].Value = sname;
dataGridView1.Rows[n].Cells[3].Value = Inst1;
}
catch (Exception ex)
{
//MessageBox.Show(ex.Message);
}
}