How to get registered path to ActiveX component

I have a registered ActiveX component that I reference in a C # project. However, I would like to know the source path to the actual executable. This is not the path itself. Is there anything more sensible than manually searching the registry?

The component is registered using the simple / regserver command, if necessary.

+3
source share
2 answers

Find the HKEY_CLASSES_ROOT\CLSIDname of your EXE file. It should be used as the value of "LocalServer32".

+1
source

Here is a function that retrieves a value from the registry. Additional verification required.

using Microsoft.Win32;

//...
static string GetCOMPath(string comName)
{
    RegistryKey comKey = Registry.ClassesRoot.OpenSubKey(comName + "\\CLSID");
    string clsid = (string)comKey.GetValue("");
    comKey = Registry.ClassesRoot.OpenSubKey("CLSID\\" + clsid + "\\LocalServer32");
    return (string)comKey.GetValue("");
}

, - - #...

+1

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


All Articles