看看用户是否安装了Adobe Flash Player?

时间:2011-12-17 15:26:13

标签: c# internet-explorer flash ie-plugins

  

可能重复:
  How can I make my application check if Adobe flash player is installed on a PC?

我需要确保用户在程序启动时安装了最新的Internet Explorer安装程序,有谁知道我可以检查这个?

2 个答案:

答案 0 :(得分:1)

使用WMI:

var query = new ManagementObjectSearcher("SELECT * FROM Win32_Product");
var res = from ManagementObject m in query.Get() where m.Properties["Name"].Value.ToString() == "Flash Player"; // I don't know the name of flash player installer
if (res.Count > 0) { ... }

答案 1 :(得分:1)

另一种方法是检查SWF文件的文件关联。这将指向一个标识符,告诉您Flash的版本,如“ShockwaveFlash.ShockwaveFlash.10”。例如:

var subKey = Registry.ClassesRoot.OpenSubKey(@"ShockwaveFlash.ShockwaveFlash\CurVer");
if (subKey != null) 
{
    var value = subKey.GetValue(null) as String;
    // TODO: parse the number after the last period in the string.
}