c# - 获取windows中已安装应用程序的列表
问题描述
我找到了从这里获取已安装程序列表的解决方案。获取系统中已安装的应用程序
但没有得到所有已安装的程序,缺少列表中的一些程序。如何在不跳过的情况下获取所有节目列表
这是我的代码..
try
{
object line;
string softwareinstallpath = string.Empty;
string registry_key = @"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall";
using (var baseKey =RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry64))
{
using (var key = baseKey.OpenSubKey(registry_key))
{
foreach (string subkey_name in key.GetSubKeyNames())
{
using (var subKey = key.OpenSubKey(subkey_name))
{
line = subKey.GetValue("DisplayName");
if (line != null)
{
listBox1.Items.Add(line);
if (line != null && (line.ToString().ToUpper().Contains("SKYPE")))
{
MessageBox.Show("SKYPE");
}
if (line != null && (line.ToString().ToUpper().Contains("QBFC")))
{
softwareinstallpath = subKey.GetValue("InstallLocation").ToString();
listBox1.Items.Add(subKey.GetValue("InstallLocation"));
break;
}
}
}
}
}
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message + Environment.NewLine + ex.StackTrace);
}
解决方案
推荐阅读
- angular - 一些空闲时间后角度可观察对象不调用
- c++ - 如果数据类型未知,如何打印 void 指针的值?
- python-3.x - pandas 自定义排序多级索引
- hibernate - JPQL 多连接提取返回错误“无法同时提取多个包”
- c++ - C++ 结构可以转换为 Microsoft Bond 结构吗?
- ios - 谷歌日历日历列表、事件列表
- video - 即使我不使用 amp-carousel,是否可以在 amp-story 中使用 amp-video-container 和 amp-video?amp-video-container 有什么作用?
- unity3d - 如何验证用户在 Unity 中绘制的形状
- flask - Flask:清除来自管理员的会话
- python - 如何从 SMS 文本字符串创建模式?