Atlanta Custom Software Development 

 
   Search        Code/Page
 

User Login
Email

Password

 

Forgot the Password?
Services
» Web Development
» Maintenance
» Data Integration/BI
» Information Management
Programming
  Database
Automation
OS/Networking
Graphics
Links
Tools
» Regular Expr Tester
» Free Tools

List all COM components on local machine

Total Hit ( 2905)

Rate this article:     Poor     Excellent 

 Submit Your Question/Comment about this article

Rating


 


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

Click here to copy the following block
' 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_ROOT\CLSID 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()
  Next
End Sub


Submitted By : Nayan Patel  (Member Since : 5/26/2004 12:23:06 PM)

Job Description : He is the moderator of this site and currently working as an independent consultant. He works with VB.net/ASP.net, SQL Server and other MS technologies. He is MCSD.net, MCDBA and MCSE. In his free time he likes to watch funny movies and doing oil painting.
View all (893) submissions by this author  (Birth Date : 7/14/1981 )


Home   |  Comment   |  Contact Us   |  Privacy Policy   |  Terms & Conditions   |  BlogsZappySys

© 2008 BinaryWorld LLC. All rights reserved.