getting component information (by name) at run time

I have a dll called "X".  In this library is a class, called "Y".  When I am troubleshooting, I often need to observe run time behavior and then search the registry for information such as the path of the library "X".  It would be nice if I could put the path of the library in the window bar at run time.  Something like the following:

Me.caption = "You are using " & getPathByName("X") & _
                    " Version: " getVersionByName("X") & _
                    " with GUID of " & getGUIDByName("X")
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Here is one of the functions so far...

getGUIDByName returns the CLSID of the ProgID passed in.

Option Explicit

'from the MS sample:

Private Type GUID
    Data1 As Long
    Data2 As Integer
    Data3 As Integer
    Data4(7) As Byte
End Type

Private Declare Function CLSIDFromProgID _
   Lib "ole32.dll" (ByVal lpszProgID As Long, _
   pCLSID As GUID) As Long

Function getGUIDByName(ByVal ProgID As String) As String
    Dim cid As GUID
    Dim lngRet As Long
    Dim i As Integer
    Dim sCLSID As String
    'Get CLSID.
    lngRet = CLSIDFromProgID(StrPtr(ProgID), cid)
    'Build CLSID
    sCLSID = Right("00000000" & Hex(cid.Data1), 8) & "-"
    sCLSID = sCLSID & Right("0000" & Hex(cid.Data2), 4) & "-"
    sCLSID = sCLSID & Right("0000" & Hex(cid.Data3), 4) & "-"
    sCLSID = sCLSID & Right("00" & Hex(cid.Data4(0)), 2) & Right("00" & Hex(cid.Data4(1)), 2) & "-"
    For i = 2 To 7
          sCLSID = sCLSID & Right("00" & Hex(cid.Data4(i)), 2)
    getGUIDByName = sCLSID
End Function

'example useage
Private Sub Command1_Click()
    Caption = getGUIDByName("excel.application")
End Sub

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
If you require to read and write to the registry view.

HOWTO: Use the Registry API to Save and Retrieve Setting
Last reviewed: October 7, 1997
Article ID: Q145679  

in the VB help file this will also give you code samples in VB source.
dbyrne03Author Commented:
Thanks Erick37.  I will use your function in combination with the one I found @;en-us;240794
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.