Results 1 to 10 of 24

Thread: Version Info using VBA and registry quirks. InterRegional Settings GmbH

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    9,521
    Rep Power
    10
    Coding discussed in last post.
    Results and conclusions in next posts

    Code:
    Option Explicit
    Sub BonnieBonnieBoundsOfCLSIDs()       ' https://www.excelfox.com/forum/showthread.php/2997-Testies-external-shared-Libraries-regedit-registry?p=25037&viewfull=1#post25037                         ' KeksXP()
    Rem 0
    On Error GoTo OtherError
    Dim Ws As Worksheet: Set Ws = Me
     Let Ws.Range("A1:I1") = Array("", "TypeName(Obj)", "ProgID", "Clsid", "Version at Clsid", "TypeLib Guid", "Version at TypeLib", "Human readable name", "File")
    'Me.Columns("A:I").Clear
    Dim StrCom As String: Let StrCom = "."
    Dim RegInfoPro As Object: Set RegInfoPro = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & StrCom & "\root\default:StdRegProv")
    Dim RegHive As Long: Let RegHive = -214748364.8 * 10
    Rem 1 Clsids  - for Clsid output, (but also to use for the other outputs)
    Dim Clsids() As Variant
    RegInfoPro.EnumKey RegHive, "CLSID", Clsids() '   Computer\HKEY_CLASSES_ROOT , CLSID , here comes the big array of all ya Clsids
    Dim ClsInfCnt As Long, Rw As Long: Let Rw = 1 '   This keeps track of the rows - there will likely be more than there are Clsids as we need an extra row for versions at the TypeLib place
        For ClsInfCnt = LBound(Clsids()) To UBound(Clsids())   ' The main Clsid Loop =======================
         Let Rw = Rw + 1 ' Every Clsid is on a new line
         Let Ws.Range("A" & Rw & "") = ClsInfCnt & "  " & Rw ' The first is a 0 and in the array is "CSID"  after that in the array you get the  { Guid thingy }  format    https://i.postimg.cc/mrHxggQD/Computer-HKEY-CLASSES-ROOT-CLSID.jpg
         Let Ws.Range("D" & Rw & "") = Clsids(ClsInfCnt) ' The main  { Clsid thingy }
        Rem 3 InprocServer32  '  This seems to be the  .dll  or similar file
        Dim IprcSvr32 As Variant
        RegInfoPro.getstringvalue RegHive, "CLSID\" & Clsids(ClsInfCnt) & "\InprocServer32", "", IprcSvr32
            If IsNull(IprcSvr32) Then
             Let Ws.Range("I" & Rw & "") = " -"
            Else
             Let Ws.Range("I" & Rw & "") = IprcSvr32
            End If
        Rem 4  ProgID  (- see Mike here  https://eileenslounge.com/viewtopic.php?p=326247#p326247 ) if there is one held "at the Clsid"
        Dim PrgID As Variant
        RegInfoPro.getstringvalue RegHive, "CLSID\" & Clsids(ClsInfCnt) & "\ProgID", "", PrgID
            If IsNull(IprcSvr32) Then
             Let Ws.Range("C" & Rw & "") = " -"
            Else
             Let Ws.Range("C" & Rw & "") = PrgID
            End If
        Rem 5  Version numnber if there is one held "at the Clsid"
        Dim CGVers As Variant
        RegInfoPro.getstringvalue RegHive, "CLSID\" & Clsids(ClsInfCnt) & "\Version", "", CGVers
            If IsNull(CGVers) Then
             Let Ws.Range("E" & Rw & "") = " -"
            Else
             Let Ws.Range("E" & Rw & "") = "'" & CGVers
            End If
        Rem 6 TypeLib Guid if there is one held "at the Clsid"
        Dim TypeLibGuid As Variant
        RegInfoPro.getstringvalue RegHive, "CLSID\" & Clsids(ClsInfCnt) & "\TypeLib", "", TypeLibGuid
            If IsNull(TypeLibGuid) Then
             Let Ws.Range("F" & Rw & "") = " -"
            Else ' Time to get the array of versions
             Let Ws.Range("F" & Rw & "") = TypeLibGuid '                       The Guid related to "human readable description" or "TypeLib human readable name" given in that little window which you use to check a external Library reference from the VB Editor , and the one to use in the .AddFromGuid
            Dim Vers As Variant, CntV As Long          ' Vers can be ab array or  Null
            '6b)
            RegInfoPro.EnumKey RegHive, "TypeLib\" & TypeLibGuid, Vers
                If IsNull(Vers) Then
                    Let Ws.Range("G" & Rw & "") = "Null  versions at  Computer\HKEY_CLASSES_ROOT\TypeLib"
                Else
                    For CntV = LBound(Vers) To UBound(Vers)
                         Let Ws.Range("G" & Rw & "") = "'" & Vers(CntV)
                        Dim Description As String ' Might think about having this Variant. This is the "human readable description" or "TypeLib human readable name" given in that little window which you use to check a external Library reference from the VB Editor , and the one to use in the .AddFromGuid
                        RegInfoPro.getstringvalue RegHive, "TypeLib\" & TypeLibGuid & "\" & Vers(CntV), "", Description
                         Let Ws.Range("H" & Rw & "") = Description
                        If CntV < UBound(Vers) Then Let Rw = Rw + 1 ' we need an extra line for the next version
                    Next CntV
                End If
            End If
        Rem 7 Try to make an object type  ' Do this last as it can crash and/ or set the Devil loose
        Dim LateBndObj As Object
        On Error GoTo BadObjType ' I expect the next line often to error when I try to use
         Set LateBndObj = CreateObject("New:" & Clsids(ClsInfCnt) & "")
        On Error GoTo OtherError
         Let Ws.Range("B" & Rw & "") = TypeName(LateBndObj)
    BonniBanksOfLochLomond:  '
        Next ClsInfCnt ' The main Clsid loop =============================================================
    Exit Sub
    BadObjType:
     Let Ws.Range("B" & Rw & "") = "Err '" & Err.Number & "': " & Err.Description
     Let Ws.Range("B" & Rw & "").Font.Color = 12632256
    On Error GoTo -1
    On Error GoTo OtherError
    GoTo BonniBanksOfLochLomond ' https://eileenslounge.com/viewtopic.php?p=326446#p326446
    OtherError:
    Stop
    Debug.Print "Err '" & Err.Number & "': " & Err.Description & "   " & ClsInfCnt & "  " & Rw
    Stop
    Resume Next
    End Sub
    
    Last edited by DocAElstein; 04-10-2025 at 02:09 AM.

Similar Threads

  1. ADS info via VBA 64bit
    By TML59 in forum Excel Help
    Replies: 9
    Last Post: 07-13-2024, 03:43 PM
  2. Replies: 26
    Last Post: 07-17-2013, 11:42 AM
  3. Office Version Independent Non-Activex Date Time Picker Using Form Controls
    By Excel Fox in forum Excel and VBA Tips and Tricks
    Replies: 0
    Last Post: 07-17-2013, 12:27 AM
  4. Info: different Value !
    By PcMax in forum Excel Help
    Replies: 2
    Last Post: 04-22-2012, 04:13 PM
  5. Version 2003 to 2007
    By PcMax in forum Excel Help
    Replies: 5
    Last Post: 11-23-2011, 07:52 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •