How to check if a certain version of a flash player is installed or not in C #.?

I want to check my code if a specific version of the flash player is installed. I used the following code

using Microsoft.Win32

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

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

In the registry If I'm looking for a flash player with version 10.2.161.23, location

"HKEY_LOCAL_MACHINE \ SOFTWARE \ Macromedia"

has two folders:

  • Flashplayer and
  • FlashPlayerActiveX.

But my above code is not working.

Please let me know how to check if a certain version of the flash player is installed on the system or not. USING C # .NET .

+3
source share
1 answer

Adobe old (pre 10) IE Flash- , VBScript, ShockwaveFlash.ShockwaveFlash. < > . , , HKCR, . HKEY_CLASSES_ROOT\ShockwaveFlash.ShockwaveFlash.10.

SWFObject , ShockwaveFlash.ShockwaveFlash $version. #:

// 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);
+3

Source: https://habr.com/ru/post/1793006/


All Articles