private void button_Click(object sender EventArgs e)
{
if (checkAdobeReader() == true)
{
MessageBoxShow(有安装 Adobe Reader );
}
else
{
MessageBoxShow(没有安装 Adobe Reader );
}
}
/// <summary>
/// 确认是否有安装 Adobe Reader
/// </summary>
/// <returns>true: 有安装 false:没有安装</returns>
private bool checkAdobeReader()
{
MicrosoftWinRegistryKey uninstallNode = MicrosoftWinRegistryLocalMachineOpenSubKey(@SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall);
foreach (string subKeyName in uninstallNodeGetSubKeyNames())
{
MicrosoftWinRegistryKey subKey = uninstallNodeOpenSubKey(subKeyName);
object displayName = subKeyGetValue(DisplayName);
if (displayName != null)
{
if (displayNameToString()Contains(Adobe Reader))
{
return true;
// MessageBoxShow(displayNameToString());
}
}
}
return false;
}