views:

391

answers:

1

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#.

A: 

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.

Helen