Get Fully Qualified File Name using TypeLib Info - January 2000

Some years ago I wrote routines to get the fully qualified file name of registered objects using its GUID. I have noticed a frequent request in various news groups for information on how to do this. So I revisited the code and updated it. It becomes the tip-of-the-month. Some of the updated code [file version info] was written by Herman Liu and downloaded from Thanks Herman and FreeVBCode.

The Demo Program

I wrote a VB6 demo program to show how the routines work. The demo program:


The demo asks for a Visual Basic project file [VBP]. It reads the project file and looks for lines that start with 'reference' or 'object'. It then passes the entire line to function 'GetFileNameUsingTypeLibInfo'. For example:

If GetFileNameUsingTypeLibInfo(sFileName, sRec) Then
sFileName - The routine returns the file name in this string.
sRec - The 'reference' or 'object' record.
Returns True if successful.

If the file is found then the demo also calls routine 'GetFileInfo' to get version information. For example:

Private Function GetVersion(sFileName As String) As String
  ' Get file version information
  Dim tFileInfo As udtFileInfo 'define a structure
  If GetFileInfo(sFileName, tFileInfo) Then 'go get it
    GetVersion = tFileInfo.sFileVersion & " [" & FormattedVersionNumber(tFileInfo) & "]"
  End If
End Function
udtFileInfo - Contains file information including the version formatted and unformatted.

Include in Your Code

Include the following modules in your code to use the functions:

modGetFileNameUsingTypeLibInfo.bas Gets the fully qualified file name.
modGetFileVersionInfo.bas Gets file information for the file.
modTBRegistry.bas Reads the registry. Click here for more information

The Demo Uses modConnectToWebSite

The demo program uses modConnectToWebSite.bas to display this page. For details on the use of that module click here.

Download VB Code

Click here to download the VB 6 Source Code [27k]. The demo uses MSComCtl.OCX for the Listview control..

Previous Tip   Tip Index   Next Tip


Updated 2000/10/29