Is there any way to use a For loop to retrieve all the properties of a control? Maybe something to the extent of ...
For each property in control
debug.print property.name
next property
Ive tried a few different ways and I am not gaining any ground.
-thanks
Why would you need to do that? The Visual Basic IDE already provides a list of the properties.
was just an idea, was curious as to how it would be done if possible... real bored.
Quote from: Imperceptus on May 26, 2006, 04:14 PM
Is there any way to use a For loop to retrieve all the properties of a control? Maybe something to the extent of ...
For each property in control
debug.print property.name
next property
Ive tried a few different ways and I am not gaining any ground.
-thanks
Yes, but you will need some help from COM programming. What the VB IDE is doing is using a callback function that queries the interface provided by the control. The functions/properties list is the interface. Go to MSDN and look for COM, QueryInterface and start reading. Chances are you're not that interested.
Quote from: Grok on May 30, 2006, 01:05 AM
Yes, but you will need some help from COM programming. What the VB IDE is doing is using a callback function that queries the interface provided by the control. The functions/properties list is the interface. Go to MSDN and look for COM, QueryInterface and start reading. Chances are you're not that interested.
Hey thanks Grok. I didn't realize that all VB's controls were COM controls.
If you're just interested in doing this with arbitrary code, Visual Basic .NET supports this through the Type (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemtypeclasstopic.asp) class. Very handy. :)
i'd hate to bump this topic but i just wanted people to know that the reason all the controls are COM because VB6 relies on the DCOM service to start
Quote from: Clan CDH on July 24, 2006, 08:49 PM
i'd hate to bump this topic but i just wanted people to know that the reason all the controls are COM because VB6 relies on the DCOM service to start
I doubt that that's the reason. It may be a result, but I'm also not sold on that.
There is a activex dll packaged with visual basic that makes reading the interfaces much easier. You WILL HAVE TO READ THE INTERFACE if you want to get the property names.
Goto Project->References and Select Typelib Information. You might want to read up on this a bit first. I use this to determine wether an activex dll plugin supports the proper interfaces before I try to load it. Most people who enumerate a dir just try to load each dll and catch the error, but I check for the interfaces first.