如何检查在 C# 中是否安装了特定版本的 Flash Player.? [英] How to check if a particular version of flash player is installed or not in C#.?

查看:35
本文介绍了如何检查在 C# 中是否安装了特定版本的 Flash Player.?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从我的代码中检查是否安装了特定版本的 Flash Player.我使用了以下代码

I want to check from my code if a particular version of flash player is installed or not. I used the following code

using Microsoft.Win32

RegistryKey RK = Registry.CurrentUser.OpenSubKey("HKEY_LOCAL_MACHINE\SOFTWARE\Macromedia\FlashPlayer");

if (RK != null)
{
    // It's there 
}
else
{
    // It's not there 
} 

在注册表中如果我搜索版本为 10.2.161.23 的 Flash Player,位置

In registry If I search for flash player with version 10.2.161.23, the location

"HKEY_LOCAL_MACHINESOFTWAREMacromedia"

"HKEY_LOCAL_MACHINESOFTWAREMacromedia"

有 2 个文件夹:

  1. FlashPlayer 和
  2. FlashPlayerActiveX.

但是,我上面的代码不起作用.

But, my above code is not working.

请告诉我如何检查系统中是否安装了特定版本的 Flash Player使用 C#.NET.

Kindly let me know how to check if a particular version of flash player is installed in a system or not USING C#.NET.

推荐答案

Adobe 旧的(pre 10)IE Flash 检测代码用于在 VBScript 中测试它是否可以实例化对象 ShockwaveFlash.ShockwaveFlash.<主要版本>.如果只是你想测试的主要版本,你可以在 HKCR 下检查那些密钥,例如HKEY_CLASSES_ROOTShockwaveFlash.ShockwaveFlash.10.

Adobe's old (pre 10) IE Flash detection code used to test in VBScript if it could instantiate object ShockwaveFlash.ShockwaveFlash.<major version>. If it's just the major version you want to test, you can check for those keys under HKCR, e.g. HKEY_CLASSES_ROOTShockwaveFlash.ShockwaveFlash.10.

SWFObject 实例化版本-less 对象名称,ShockwaveFlash.ShockwaveFlash,并查询其 $version 属性.要在 C# 中执行此操作:

SWFObject instantiates the version-less object name, ShockwaveFlash.ShockwaveFlash, and queries its $version property. To do this in C#:

// Look up flash object type from registry
var type = Type.GetTypeFromProgID("ShockwaveFlash.ShockwaveFlash");
if (type == null)
{
  // No flash
  return;
}

// Create a flash object to query
// (should probably try/catch around CreateInstance)
var flashObject = Activator.CreateInstance(type);
var versionString = flashObject.GetType()
                      .InvokeMember("GetVariable", BindingFlags.InvokeMethod,
                                    null, flashObject, new object[] {"$version"})
                    as string;
// e.g. "WIN 10,2,152,26"

// Clean up allocated COM Object
Marshal.ReleaseComObject(flashObject);

这篇关于如何检查在 C# 中是否安装了特定版本的 Flash Player.?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆