views:

38

answers:

3

Is there a way to get the file and/or assembly version for an object in VB6?

We are having some reference issues, and I am able to create the object in late binding on the machine that is having problems so I am hoping to spit out the version it is grabbing to figure out where that version is sitting.

+2  A: 

You might try to use TypeLibInfo to fish some information out.

In VB6, go to References and reference TypeLib Information. Then create an object and, in the debugger, try to examine various properties. Example:

  Dim x As Object

  Set x = CreateObject("Excel.Application")
  x.Visible = True


  Dim ti As TLI.TLIApplication
  Set ti = New TLI.TLIApplication

  With ti.InterfaceInfoFromObject(x)
    MsgBox .Guid
  End With


  'Close Excel yourself if things went bad.
GSerg
Getting an error "Method 'InterfaceInforFromObject' of object '_TLIApplication' failed". It does compile though, and the intelisense shows that method.
IPX Ares
Then try ClassInfoFromObject. You never know. It actually depends on the object in which way it can be examined.
GSerg
+3  A: 

It sounds as if you have access to the problem machine.

If this is an in-process object (DLL or OCX) can I recommend you just use ProcessExplorer instead?

Do Start\Run and type http://live.sysinternals.com/procexp.exe to run Process Explorer. Highlight your application in the process list, switch to DLL view, and the lower pane will show the path and version number of all DLLs and OCXs loaded by the process.

If it is an out-of-process object, I suggest looking in the registry to see which program is registered as the server.

  1. First find the CLSID by using the ProgID to find an entry in the registry. The ProgID is the human-readable string that can be used with CreateObject, e.g. Excel.Application. The CLSID is a 128-bit number, in hex, within a pair of curly braces. Look at the registry entry HKEY_LOCAL_MACHINE\SOFTWARE\Classes\{ProgID}\CLSID

  2. Look at the LocalServer32 entry underneath HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{ClsId}\, where {ClsId} is the class-id of the object. This entry gives you the path to the exe that provides the object.

MarkJ
A: 

Is the Object your own VB Class etc, or a 3rd party COM component?

Paul Williams