devxlogo

List all COM components on local machine

List all COM components on local machine

The following routine parses the registry and lists all the installed COM components:

' this code assumes that you have used this Imports statement' Imports Microsoft.Win32' Print ProgID, CLSID, and path of all the COM components' installed on this computer.Sub DisplayCOMComponents()    ' Open the HKEY_CLASSES_ROOTCLSID key    Dim regClsid As RegistryKey = Registry.ClassesRoot.OpenSubKey("CLSID")    ' Iterate over all the subkeys.    Dim clsid As String    For Each clsid In regClsid.GetSubKeyNames        ' Open the subkey.        Dim regClsidKey As RegistryKey = regClsid.OpenSubKey(clsid)        ' Get the ProgID. (This is the default value for this key.)        Dim ProgID As String = CStr(regClsidKey.GetValue(""))        ' Get the InProcServer32 key, which holds the DLL path.        Dim regPath As RegistryKey = regClsidKey.OpenSubKey("InprocServer32")        If regPath Is Nothing Then            ' If not found, it isn't an in-process DLL server,             ' let's see if it's an out-of-process EXE server.            regPath = regClsidKey.OpenSubKey("LocalServer32")        End If        If Not (regPath Is Nothing) Then            ' If either key has been found, retrieve its default value.            Dim filePath As String = CStr(regPath.GetValue(""))            ' Display all the relevant info gathered so far.            Console.WriteLine(ProgId & " " & clsid & " -> " & filePath)            ' Always close registry keys.            regPath.Close()        End If        ' Always close registry keys.        regClsidKey.Close()    NextEnd Sub

See also  Professionalism Starts in Your Inbox: Keys to Presenting Your Best Self in Email
devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist