Visual Basic Programming Code Examples Visual Basic > API and Miscellaneous Code Examples Returning the installation path of a DLL or OCX using a ProgID Returning the installation path of a DLL or OCX using a ProgID When upgrading your existing applications it is always useful to be able to find out where the user has installed existing DLLs/OCXs. The code below will return the installation path of these components. 'Purpose : Returns the location that a specific DLL/OCX has been installed and registered to. 'Inputs : Class The application name and class of the object to return the path of. 'Outputs : Returns the path to the file containing the specified DLL/OCX or an empty string if an error occurred. 'Example : Debug.Print ObjectInstallPath("COMCTL.ListViewCtrl") 'Notes : Requires "TLBINF32.DLL" to be installed and registered on the calling machine. Public Function ObjectInstallPath(Class As String) As String Dim oTypeInfo As Object 'TypeInfo Dim oTLI As Object Dim oObject As Object On Error GoTo ErrFailed 'Create a reference to the object Set oObject = CreateObject(Class) Set oTLI = CreateObject("TLI.TLIApplication") 'Get the object type library Set oTypeInfo = oTLI.ClassInfoFromObject(oObject) 'Return the object path ObjectInstallPath = oTypeInfo.Parent.ContainingFile 'Release references Set oObject = Nothing Set oTypeInfo = Nothing Set oTLI = Nothing Exit Function ErrFailed: Debug.Print Err.Description Debug.Assert False End Function