Results 1 to 11 of 11

Thread: [RESOLVED] Hide some Activex-Classes in VB6-Object-Browser

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Aug 2020
    Posts
    1,447

    Resolved [RESOLVED] Hide some Activex-Classes in VB6-Object-Browser

    We know that by right-clicking in the Object-Browser of VB6-IDE, the "Show Hidden Members" menu item can be displayed. I'd like to know how to set the hidden status of members.


    Additional Notes:

    In my ActiveX DLL, there are some special classes with underscores as name suffixes, which I want to hide in VB6-Object-Browser, but users can still use these classes in the code editing window. I'd like to know how to make these classes hidden in the VB6-Object-Browser (of course, they can be displayed through the "Show Hidden Member" menu). Thanks.
    Last edited by SearchingDataOnly; Dec 5th, 2022 at 05:22 AM.

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

    Re: Hide some Activex-Classes in VB6-Object-Browser

    You use the Procedure Attributes dialog. VB6 has the neat feature called "documentation" you can read.

  3. #3
    PowerPoster Elroy's Avatar
    Join Date
    Jun 2014
    Location
    Near Nashville TN
    Posts
    9,936

    Re: Hide some Activex-Classes in VB6-Object-Browser

    In the Visual Basic 6 (VB6) Integrated Development Environment (IDE), the Object Browser is a tool that allows you to browse the properties, methods, and events of various objects in your code. By default, the Object Browser only displays members that are not marked as "hidden," but you can use the "Show Hidden Members" option to view all members, including those that are marked as hidden.

    To set the hidden status of a member, you can use the Visible attribute of the member. For example, if you have a method named "DoSomething" that you want to hide from the Object Browser, you can add the following code:


    Code:
    Private Sub DoSomething()
        ' Method implementation here
    End Sub
    Attribute DoSomething.VB_UserMemId = -4
    Attribute DoSomething.VB_Visible = False
    The first line of code defines the method, and the second and third lines use the Attribute statement to set the Visible attribute of the method to False. This will cause the method to be marked as hidden in the Object Browser.

    Alternatively, you can use the Visible attribute in the Properties window of the VB6 IDE to set the hidden status of a member. To do this, open the Properties window for the member, and then set the Visible property to False. This will have the same effect as using the Attribute statement in your code.

    It's important to note that setting the hidden status of a member in the Object Browser will not prevent the member from being called or used in your code. It will only affect its visibility in the Object Browser.

    (via ChatGPT. Since Wqweto started using it, I had to try it. It's not bad. )
    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. To all, peace and happiness.

  4. #4

    Thread Starter
    Frenzied Member
    Join Date
    Aug 2020
    Posts
    1,447

    Re: Hide some Activex-Classes in VB6-Object-Browser

    Thank you, Elroy, dilettante.

    What I want to hide is the "class name" instead of the "method name".

    My ActiveX-Dll has hundreds of classes, and there are many companion-classes or helper-classes, for example: MyClass has a helper-class MyClass_, and the presence of these helper-classes in the Object-Browser can be confusing. So I want these classes to be hidden, but they can be displayed via "Show Hidden Members" menu.
    Last edited by SearchingDataOnly; Dec 6th, 2022 at 06:46 AM.

  5. #5
    PowerPoster Arnoutdv's Avatar
    Join Date
    Oct 2013
    Posts
    5,904

    Re: Hide some Activex-Classes in VB6-Object-Browser

    You want to hide them but they are not private classes?

  6. #6

    Thread Starter
    Frenzied Member
    Join Date
    Aug 2020
    Posts
    1,447

    Re: Hide some Activex-Classes in VB6-Object-Browser

    Quote Originally Posted by Arnoutdv View Post
    You want to hide them but they are not private classes?
    Yes, they are public classes. Users can call and use them normally in the code window. The purpose of hiding them in the Object-Browser window is only to reduce clutter.

    The following are the classes displayed in the Object-Browser window
    Code:
    MyClass001
    MyClass001_ (MyClass001Static)
    
    MyClass002
    MyClass002_ (MyClass002Static)
    
    ...
    ...
    
    MyClass400
    MyClass400_ (MyClass800Static)
    I want to hide all classes with underscores as suffixes in the object browser.
    Last edited by SearchingDataOnly; Dec 6th, 2022 at 10:56 PM.

  7. #7
    PowerPoster Arnoutdv's Avatar
    Join Date
    Oct 2013
    Posts
    5,904

    Re: Hide some Activex-Classes in VB6-Object-Browser

    Sounds like a lot of fuzz about nothing.

  8. #8
    PowerPoster wqweto's Avatar
    Join Date
    May 2011
    Location
    Sofia, Bulgaria
    Posts
    5,156

    Re: Hide some Activex-Classes in VB6-Object-Browser

    Quote Originally Posted by SearchingDataOnly View Post
    Yes, they are public classes. Users can call and use them normally in the code window. The purpose of hiding them in the Object-Browser window is only to reduce clutter.

    The following are the classes displayed in the Object-Browser window
    Code:
    MyClass001
    MyClass001_ (MyClass001Static)
    
    MyClass002
    MyClass002_ (MyClass002Static)
    
    ...
    ...
    
    MyClass400
    MyClass400_ (MyClass800Static)
    I want to hide all classes with underscores as suffixes in the object browser.
    You cannot do this with stock VB6 compiler.

    It's completely possible to hide coclasses but you'll need some kind of post-compile processing done on the typelib.

    cheers,
    </wqw>

  9. #9

    Thread Starter
    Frenzied Member
    Join Date
    Aug 2020
    Posts
    1,447

    Re: Hide some Activex-Classes in VB6-Object-Browser

    Quote Originally Posted by wqweto View Post
    You cannot do this with stock VB6 compiler.

    It's completely possible to hide coclasses but you'll need some kind of post-compile processing done on the typelib.

    cheers,
    </wqw>
    Thank you, wewqto. I know it's difficult to handle it in VB6, so I'd like to know if there's a way to handle it in typelib. My current tlb file is generated from ActiveX-DLL. If typelib solves my problem, then I'll try to use typelib.
    Last edited by SearchingDataOnly; Dec 7th, 2022 at 04:27 AM.

  10. #10
    Frenzied Member
    Join Date
    Jun 2015
    Posts
    1,068

    Re: Hide some Activex-Classes in VB6-Object-Browser

    does hiding a coclass from the objbrowser hide it from intellisense? that would be a deal breaker.

    If there were to many classes that it was annoying, I would probably just use a custom object browser
    you could add filtering. While the vb6 objbrowser is good, it could certainly be made better.

  11. #11

    Thread Starter
    Frenzied Member
    Join Date
    Aug 2020
    Posts
    1,447

    Re: Hide some Activex-Classes in VB6-Object-Browser

    Quote Originally Posted by dz32 View Post
    If there were to many classes that it was annoying, I would probably just use a custom object browser
    you could add filtering. While the vb6 objbrowser is good, it could certainly be made better.
    It's an excellent idea, maybe I can add "grouping" and "namespace" features to the custom object-browser. Thank you very much, dz32.

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