Results 1 to 12 of 12

Thread: Finding OLB, TLB file paths dynamically at runtime ?

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jun 2022
    Posts
    71

    Finding OLB, TLB file paths dynamically at runtime ?

    I can find exe and dll full file paths using GetModuleHandle and GetModuleFileName apis.

    Is there a similar approach for finding .olb and .tlb file paths ?

    Thanks.

  2. #2
    PowerPoster Zvoni's Avatar
    Join Date
    Sep 2012
    Location
    To the moon and then left
    Posts
    3,342

    Re: Finding OLB, TLB file paths dynamically at runtime ?

    One System to rule them all, One Code to find them,
    One IDE to bring them all, and to the Framework bind them,
    in the Land of Redmond, where the Windows lie
    ---------------------------------------------------------------------------------
    People call me crazy because i'm jumping out of perfectly fine airplanes.
    ---------------------------------------------------------------------------------
    Code is like a joke: If you have to explain it, it's bad

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Jun 2022
    Posts
    71

    Re: Finding OLB, TLB file paths dynamically at runtime ?

    Quote Originally Posted by Zvoni View Post
    Thank you Zvoni. I was hoping to find an easier way. Like a self-searching function to which you simply pass the name of the olb\tlb and it returns its full path

  4. #4
    PowerPoster Zvoni's Avatar
    Join Date
    Sep 2012
    Location
    To the moon and then left
    Posts
    3,342

    Re: Finding OLB, TLB file paths dynamically at runtime ?

    How would that work?
    if its not registered, then a TLB is like any other file (like a something.txt).
    The only approach for not registered TLBs to keep them close to the app (e.g. their own subfolder)
    One System to rule them all, One Code to find them,
    One IDE to bring them all, and to the Framework bind them,
    in the Land of Redmond, where the Windows lie
    ---------------------------------------------------------------------------------
    People call me crazy because i'm jumping out of perfectly fine airplanes.
    ---------------------------------------------------------------------------------
    Code is like a joke: If you have to explain it, it's bad

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Jun 2022
    Posts
    71

    Re: Finding OLB, TLB file paths dynamically at runtime ?

    Quote Originally Posted by Zvoni View Post
    How would that work?
    if its not registered, then a TLB is like any other file (like a something.txt).
    The only approach for not registered TLBs to keep them close to the app (e.g. their own subfolder)
    I was actually referring to registered tlbs,olbs.

    You would need the GUID for it though.
    I was hoping to avoid the need to resort to the GUID. I was hoping to find the path based on the tlb name . Something similar to what GetModuleFileName does.

    Thanks.

  6. #6
    PowerPoster Elroy's Avatar
    Join Date
    Jun 2014
    Location
    Near Nashville TN
    Posts
    8,173

    Re: Finding OLB, TLB file paths dynamically at runtime ?

    Here's a thread you should probably take a look at.

    There are three things in that thread that come pretty close to doing what you want:

    1. That link to the little NirSoft utility. Shell to it with the resource's file name, and tell it to dump to a text file, then read the file.
    2. That code in Github which suggests that it does it with VB6 code.
    3. Using TLBINF32.DLL as Eduardo has suggested.


    It seems that one of those should get you to where you'd like to be.

    ---------

    EDIT: Or maybe I misunderstand. You want the path to the resource? Why do you need that? And yeah, I wouldn't know of another way to do that short of digging through the registry (assuming it's registered). What are you going to do to it? Tag a virus onto the end of it?
    Any software I post in these forums written by me is provided AS IS without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. Please understand that Ive been programming since the mid-1970s and still have some of that code. My contemporary VB6 project is approaching 1,000 modules. In addition, I have a VB6 random code folder that is overflowing. Ive been at this long enough to truly not know with absolute certainty from whence every single line of my code has come, with much of it coming from programmers under my employ who signed intellectual property transfers. I have not deliberately attempted to remove any licenses and/or attributions from any software. If someone finds that I have inadvertently done so, I sincerely apologize, and, upon notice and reasonable proof, will re-attach those licenses and/or attributions. To all, peace and happiness.

  7. #7

    Thread Starter
    Lively Member
    Join Date
    Jun 2022
    Posts
    71

    Re: Finding OLB, TLB file paths dynamically at runtime ?

    Quote Originally Posted by Elroy View Post
    ---------

    EDIT: Or maybe I misunderstand. You want the path to the resource? Why do you need that? And yeah, I wouldn't know of another way to do that short of digging through the registry (assuming it's registered). What are you going to do to it? Tag a virus onto the end of it?
    I have been writing some code that takes a tlb\olb filepathname and returns a collection of the tlb\olb Enums (enum names and their respective values)

    I was just hoping to make it easier by not needing to supply the full tlb pathname to the function.

    BTW, thanks a lot for the links. I donwnloded the NirSofft utility.

  8. #8
    PowerPoster Elroy's Avatar
    Join Date
    Jun 2014
    Location
    Near Nashville TN
    Posts
    8,173

    Re: Finding OLB, TLB file paths dynamically at runtime ?

    Quote Originally Posted by AngelV View Post
    I have been writing some code that takes a tlb\olb filepathname and returns a collection of the tlb\olb Enums (enum names and their respective values)

    I was just hoping to make it easier by not needing to supply the full tlb pathname to the function.

    BTW, thanks a lot for the links. I donwnloded the NirSofft utility.
    No problem. Sorry if I was abrupt. I'm just still not sure why you need this, as there are 100s if not 1000s of files with typelibs in them on our computers. Are you going to index them all?
    Any software I post in these forums written by me is provided AS IS without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. Please understand that Ive been programming since the mid-1970s and still have some of that code. My contemporary VB6 project is approaching 1,000 modules. In addition, I have a VB6 random code folder that is overflowing. Ive been at this long enough to truly not know with absolute certainty from whence every single line of my code has come, with much of it coming from programmers under my employ who signed intellectual property transfers. I have not deliberately attempted to remove any licenses and/or attributions from any software. If someone finds that I have inadvertently done so, I sincerely apologize, and, upon notice and reasonable proof, will re-attach those licenses and/or attributions. To all, peace and happiness.

  9. #9
    Fanatic Member
    Join Date
    Jun 2015
    Posts
    748

    Re: Finding OLB, TLB file paths dynamically at runtime ?

    You really have to start with the guid for the context of whats relevant.

    Different libraries can define the same function names and enum names
    Anyway they want. What if a newer version of the lib added an extra argument.

    Heres an old lookup routine from registry by guid. It may be nave if the type lib was in a separate tlb file and untested with 64bit com servers but it will give you an idea anyway

    https://github.com/dzzie/MAP/blob/45...dFile.frm#L149

  10. #10

    Thread Starter
    Lively Member
    Join Date
    Jun 2022
    Posts
    71

    Re: Finding OLB, TLB file paths dynamically at runtime ?

    Quote Originally Posted by dz32 View Post
    You really have to start with the guid for the context of whats relevant.

    Different libraries can define the same function names and enum names
    Anyway they want. What if a newer version of the lib added an extra argument.

    Heres an old lookup routine from registry by guid. It may be nave if the type lib was in a separate tlb file and untested with 64bit com servers but it will give you an idea anyway

    https://github.com/dzzie/MAP/blob/45...dFile.frm#L149
    That is a useful lookup routine. Thanks for your time and effort.

  11. #11

    Thread Starter
    Lively Member
    Join Date
    Jun 2022
    Posts
    71

    Re: Finding OLB, TLB file paths dynamically at runtime ?

    Quote Originally Posted by Elroy View Post
    No problem. Sorry if I was abrupt. I'm just still not sure why you need this, as there are 100s if not 1000s of files with typelibs in them on our computers. Are you going to index them all?
    No. Just a few tlbs required or frequently used in office apps such as Word, Excel, PPoint, Access, vba, vbe, MsForms, UIAutomation, Accessibility etc ...BTW, I already provide the option to load the tlb by providing the tlb fullpath or GUID. I just wanted to make it a bit easier for the end user.

    Thanks.

  12. #12
    Fanatic Member
    Join Date
    Jun 2015
    Posts
    748

    Re: Finding OLB, TLB file paths dynamically at runtime ?

    If its a known static list to drive an intellisense feature you can ditch the type libs completely and just create a utility to dump them to an easier to use format. I just use text file formats. I avoid tlbinf where I can.

Posting Permissions

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



Click Here to Expand Forum to Full Width