通过c#代码怎么获取本机都安装了哪些浏览器呢? 如题,如何获取本机都安装了哪些浏览器呢? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 可以遍历安装软件的列表,然后逐一判断 using (RegistryKey key = Registry.LocalMachine.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Uninstall", false)) { if (key != null)//判断对象存在 { foreach (string keyName in key.GetSubKeyNames())//遍历子项名称的字符串数组 { using (RegistryKey key2 = key.OpenSubKey(keyName, false))//遍历子项节点 { if (key2 != null) { string softwareName = key2.GetValue("DisplayName", "").ToString();//获取软件名 string installLocation = key2.GetValue("InstallLocation", "").ToString();//获取安装路径 if (!string.IsNullOrEmpty(installLocation)) { //将信息添加到ListView控件中 ListViewItem item = new ListViewItem(softwareName); item.SubItems.Add(installLocation); listView1.Items.Add(item); } } } } } } } using (RegistryKey key = Registry.LocalMachine.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Uninstall", false)) { if (key != null)//判断对象存在 { foreach (string keyName in key.GetSubKeyNames())//遍历子项名称的字符串数组 { using (RegistryKey key2 = key.OpenSubKey(keyName, false))//遍历子项节点 { if (key2 != null) { string softwareName = key2.GetValue("DisplayName", "").ToString();//获取软件名 string installLocation = key2.GetValue("InstallLocation", "").ToString();//获取安装路径 if (!string.IsNullOrEmpty(installLocation)) { //将信息添加到ListView控件中 ListViewItem item = new ListViewItem(softwareName); item.SubItems.Add(installLocation); listView1.Items.Add(item); } } } } } } } Asp.Net奇怪的问题!vs2008+Access2003或者Access2007 动态表格sql语句查询 c# 语句错误改正 (急切求助)CE5.0下如何用Socket向Oracle数据库传数据来替代WebService?(在线等) 服务器读取用户端windows登录信息 C#调用VC的DLL。需要传入一个字符指针,怎么办,谢谢。 进程间通信 一个有关WAP访问的问题 C++ 中的 CString 的Format 方法在C#中如何实现 .net做的项目能否部署在unix下? 流媒体播放器实现功能及分析 C# 如何找到一段文本中图片标签 急! 在线等
using (RegistryKey key = Registry.LocalMachine.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Uninstall", false))
{
if (key != null)//判断对象存在
{
foreach (string keyName in key.GetSubKeyNames())//遍历子项名称的字符串数组
{
using (RegistryKey key2 = key.OpenSubKey(keyName, false))//遍历子项节点
{
if (key2 != null)
{
string softwareName = key2.GetValue("DisplayName", "").ToString();//获取软件名
string installLocation = key2.GetValue("InstallLocation", "").ToString();//获取安装路径
if (!string.IsNullOrEmpty(installLocation))
{
//将信息添加到ListView控件中
ListViewItem item = new ListViewItem(softwareName);
item.SubItems.Add(installLocation);
listView1.Items.Add(item);
}
}
}
}
}
} }
{
if (key != null)//判断对象存在
{
foreach (string keyName in key.GetSubKeyNames())//遍历子项名称的字符串数组
{
using (RegistryKey key2 = key.OpenSubKey(keyName, false))//遍历子项节点
{
if (key2 != null)
{
string softwareName = key2.GetValue("DisplayName", "").ToString();//获取软件名
string installLocation = key2.GetValue("InstallLocation", "").ToString();//获取安装路径
if (!string.IsNullOrEmpty(installLocation))
{
//将信息添加到ListView控件中
ListViewItem item = new ListViewItem(softwareName);
item.SubItems.Add(installLocation);
listView1.Items.Add(item);
}
}
}
}
}
} }