无法在 WMI win32_product 表中找到 Flash Player

发布于 2024-08-02 22:44:24 字数 246 浏览 9 评论 0原文

为什么 Macromedia Flash Player 没有出现在 WMI win32_product 表中? Flash Player 安装在我执行查询的计算机上。

我正在尝试执行以下查询:

Select * From win32_product where name like '%Flash%'

是否有其他方法可以获取任何已安装的 Flash Player 的版本。该项目是用C#开发的。

How come the Macromedia Flash Player isn't present in the WMI win32_product table? The Flash Player is installed on the machine where I'm executing the query.

I'm trying to execute the following query:

Select * From win32_product where name like '%Flash%'

Is there any other way to get the version of any installed Flash Player. This project is developed in C#.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

挖鼻大婶 2024-08-09 22:44:24

Win32_Product 类仅代表由 Windows 安装程序。看来 Flash Player 使用了其他安装服务。

以下是确定 Flash Player ActiveX 控件(适用于 IE 的 Flash Player)是否存在及其版本的方法:

  1. 尝试获取 System.TypeShockwaveFlash.ShockwaveFlash ProgID 对应的对象。如果无法获取,则说明 Flash Player 未安装。如果成功,请转至步骤2。
  2. 创建获取的Type对象的实例。
  3. 使用“$version”参数调用获取的对象的GetVariable方法。这将为您提供 Flash Player 版本字符串,格式为“操作系统主要、次要、发行版、内部版本”,例如“WIN 10,0,22,87”。

像这样的东西(免责声明:我不太了解 C#,所以这段代码可能很蹩脚):

Type tFlash = Type.GetTypeFromProgID("ShockwaveFlash.ShockwaveFlash");
if (tFlash != null)
{
    object FlashPlayer = Activator.CreateInstance(tFlash);
    string version = (string) tFlash.InvokeMember("GetVariable",
        System.Reflection.BindingFlags.InvokeMethod,
        null, FlashPlayer, new Object[] {"$version"});

    Console.WriteLine(version);
}
else
{
    Console.WriteLine("Flash Player is not installed.");
}

请注意,这种方法要求您为 x86 平台构建应用程序,因为 Flash Player 目前是仅限 32 位,您无法通过 64 位代码与其 ActiveX 对象交互。

The Win32_Product class only represents products that are installed by Windows Installer. Looks like Flash Player uses another installation service.

Here's how you can determine the existence and version of the Flash Player ActiveX control (Flash Player for IE):

  1. Try obtaining the System.Type object corresponding to the ShockwaveFlash.ShockwaveFlash ProgID. If you fail to get it, then the Flash Player is not installed. If you succeed, go to step 2.
  2. Create an instance of the obtained Type object.
  3. Call the GetVariable method of the obtained object with the "$version" parameter. This will give you the Flash Player version string in the form "OS major,minor,release,build", e.g. "WIN 10,0,22,87".

Something like this (Disclaimer: I don't know C# well, so this code may be lame):

Type tFlash = Type.GetTypeFromProgID("ShockwaveFlash.ShockwaveFlash");
if (tFlash != null)
{
    object FlashPlayer = Activator.CreateInstance(tFlash);
    string version = (string) tFlash.InvokeMember("GetVariable",
        System.Reflection.BindingFlags.InvokeMethod,
        null, FlashPlayer, new Object[] {"$version"});

    Console.WriteLine(version);
}
else
{
    Console.WriteLine("Flash Player is not installed.");
}

Note that this approach requires that you build your application for the x86 platform, since the Flash Player is currently 32-bit only and you cannot interact with its ActiveX object from 64-bit code.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文