|
楼主 |
发表于 2020-9-30 19:11:59
|
显示全部楼层
福建省漳州市
没有人会吗?我只有差一个软件的地址而已了,求求你们了!
- string tempType = null;
- object displayName = null, uninstallString = null, releaseType = null ;
- RegistryKey currentKey = null;
- int softNum = 0;
- RegistryKey pregkey = Registry.LocalMachine.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Uninstall");//获取指定路径下的键
- try
- {
- foreach (string item in pregkey.GetSubKeyNames()) //循环所有子键
- {
- currentKey = pregkey.OpenSubKey(item);
- displayName = currentKey.GetValue("DisplayName"); //获取显示名称
- uninstallString = currentKey.GetValue("UninstallString"); //获取卸载字符串路径
- releaseType = currentKey.GetValue("ReleaseType"); //发行类型,值是Security Update为安全更新,Update为更新
- bool isSecurityUpdate = false;
- if (releaseType != null)
- {
- tempType = releaseType.ToString();
- if (tempType == "Security Update" || tempType == "Update")
- isSecurityUpdate = true;
- }
- if (!isSecurityUpdate && displayName != null && uninstallString != null)
- {
- softNum++;
- listView1.Items.Add(displayName.ToString());
- listView1.Items[0].ImageIndex = 0;
- // listView1.Items.Insert(0, displayName.ToString());
- }
- }
- }
- catch (Exception E)
- {
- MessageBox.Show(E.Message.ToString());
- }
- pregkey.Close();
复制代码 |
|