private bool checkHasInstalledSoftWare(string displayName)
{
Microsoft.Win32.RegistryKey uninstallNode = Microsoft.Win32.Registry.LocalMachine.OpenSubKey(@"SOFTWAREMicrosoftWindowsCurrentVersionUninstall");
foreach (string subKeyName in uninstallNode.GetSubKeyNames())
{
Microsoft.Win32.RegistryKey subKey = uninstallNode.OpenSubKey(subKeyName);
object disName = subKey.GetValue("DisplayName");
if (disName != null)
{
if (disName.ToString()== displayName)
{
return true;
// MessageBox.Show(displayName.ToString());
Debug.Print(""+displayName);//Microsoft Edge
}
}
}
return false;
}
调用:
if (checkHasInstalledSoftWare("Microsoft Edge"))
{
//.......
}
else {
//-----------
}