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):
- 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.
- Create an instance of the obtained
Type
object.
- 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.