实现效果:
知识运用:
RegistryKey类的GetSubKeyNames方法
public string[] GetSubKeyNames() //j检索用来包含 所有子项名称的字符串数组
实现代码:
private void button1_Click(object sender, EventArgs e) { try { RegistryKey regMain = Registry.LocalMachine; RegistryKey regChild = regMain.OpenSubKey(@"SOFTWAREMicrosoftWindowsCurrentVersionUninstall"); foreach(string s in regChild.GetSubKeyNames()) { if (s.Substring(0, 1) != "{") listBox1.Items.Add(s); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }