Results 1 to 6 of 6

Thread: Access Object Browser items from an addin

  1. #1

    Thread Starter
    New Member
    Join Date
    Sep 2021
    Posts
    3

    Access Object Browser items from an addin

    Hi, I was wondering if anyone knows of a way to access information on methods, enums & constants for your currently loaded project(s), similar to how the Object Browser accesses them?

    I'm basically looking at writing a custom object browser with extra search abilities like filtering on just constants or enums, names or values etc.

    So, if I had the following code:

    Code:
    Option Explicit
    
    Enum test
        a
        b
        c
    End Enum
    
    Private Const AA_CONST = "abc"
    
    Private Sub SubWithByval(ByVal this As String)
    
    End Sub
    
    Private Sub Form_Load()
    
        SubWithByval
        
    End Sub
    I'd like to be able to access that I had:

    The enum 'test' with entries of a,b,c
    The const 'AA_CONST' with a value of "abc"
    The method SubWithByval with a byval parameter of 'this'

    I can see how to get the enum, const and method names (from the Members collection in CodeModule) but not their values/parameters. The only way I can currently think of doing this is by retrieving it from the code modules by using the CodeLocation property.

    For further background as to why I'm trying to do this, I'm working on a huge legacy app with no consistent approach to where constants, enums & methods are held, hopefully this would help identify duplicates and aid towards code improvement.

    If anyone knows of a better way I'd be really grateful.

    Thanks.

  2. #2

  3. #3

    Thread Starter
    New Member
    Join Date
    Sep 2021
    Posts
    3

    Re: Access Object Browser items from an addin

    Thanks I will do

    I thought that was only for DLLs, didn't realise it could be used for your active '.vbp' file too but you live and learn.

    Thank you for replying, it's appreciated.

  4. #4
    Frenzied Member
    Join Date
    Jun 2015
    Posts
    1,053

    Re: Access Object Browser items from an addin

    this addin should let you navigate easily. Also include a find all search interface

    https://www.vbforums.com/showthread....-Addin-for-vb6

    for parameters and values I think you will have to parse the line manually.

    The search all form goes a long way in helping you untangle old nasty code.
    More automation tools could be built with the code that creates the treeview.
    Last edited by dz32; Sep 15th, 2021 at 03:00 PM.

  5. #5
    PowerPoster
    Join Date
    Feb 2006
    Posts
    24,482

    Re: Access Object Browser items from an addin

    If you never got the SDK when it was still posted then you won't have the documentation (a CHM Help document).

    About the only thing left online now might be Visual Basic: Inspect COM Components Using the TypeLib Information Object Library

    Microsoft started removing VB6 support downloads long ago, and by 2006 or so they really picked up steam.

  6. #6

    Thread Starter
    New Member
    Join Date
    Sep 2021
    Posts
    3

    Re: Access Object Browser items from an addin

    Thank you for the replies, it's appreciated and you've given me avenues to check.

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