none
detect ActiveX control installed or not c# example RRS feed

  • Question

  • Hi,

    How to find ActiveX control installed or not on a machine c# example.

    Regards,

    Yogi


    yogi

    Monday, February 12, 2018 4:42 PM

All replies

  • Hello yogi,

    Quote from this link,

    All the ActiveX controls are listed under HKEY_LOCAL_MACHINE\Software\CLASSES\CLSID.

    And you could access registry by below code.

     static void Main(string[] args)
            {
                using (var hklm = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry64))
                using (var key = hklm.OpenSubKey(@"SOFTWARE\Classes\CLSID"))
                {
                    // key now points to the 64-bit key
    
                    foreach (var v in key.GetSubKeyNames())
                    {
                        //Console.WriteLine(v);
    
                        RegistryKey subKey = key.OpenSubKey(v);
    
                        if (subKey != null) {
                            Console.WriteLine(subKey.GetValue(null));
                        }
                    }
                }

    Best regards,

    Neil Hu


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, February 13, 2018 9:54 AM
    Moderator
  • Or rather, call Type.GetTypeFromCLSID() (for the GUID ClassID) or Type.GetTypeFromProgId() (for type name like "HNetCfg.FwPolicy2") for more consistent result. (No matter you target your code to 32 or 64 bit, as long as these return a type, you know the type is available to your code.)

    Tuesday, February 13, 2018 10:29 AM
    Answerer