实现效果:
知识运用:
RegistryKey类的GetSubKeyNames方法
public string[] GetSubKeyNames() //j检索用来包含 所有子项名称的字符串数组
实现代码:
private void button1_Click(object sender, EventArgs e) { try { RegistryKey regMain = Registry.LocalMachine; RegistryKey regChild = regMain.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall"); foreach(string s in regChild.GetSubKeyNames()) { if (s.Substring(0, 1) != "{") listBox1.Items.Add(s); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
原文地址:https://www.cnblogs.com/feiyucha/p/10332014.html
时间: 2024-11-13 08:02:58