Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Taking exposure to the next step

Status
Not open for further replies.

Karl Blessing

Programmer
Feb 25, 2000
2,936
US
I've made ActiveX for a little while, but I've always exposed properties, and functions, rather simple such as

.Dothis(....)
.thisproperty

etc, what I want to be able to do is
MyDll.Item("KeyName").CommandForthisKey
or
MyDll.Item("KeyName").PropertyForthisKey

something along those lines, so I wouldnt have to do
MyDll.Command(Keyname,....)
[sig]<p>Karl<br><a href=mailto:kb244@kb244.com>kb244@kb244.com</a><br><a href= </a><br>Experienced in : C++(both VC++ and Borland),VB1(dos) thru VB6, Delphi 3 pro, HTML, Visual InterDev 6(ASP(WebProgramming/Vbscript)<br>
[/sig]
 
Karl,

Not sure what your project involves exactly, but would it be reasonable to have the Item() method (or property) in your example return a reference to an object and then have the collection populated with the relevant objects? In Other words:

Private mCol as Collection ' populated with relevant objects

Public Property Get Item(KeyName As String) As Object
On Error Goto ET
Set Item=mCol.Item(KeyName)
Exit Property
ET:
Set Item=Nothing
End Property

Then from the outside:

MyDll.Item(&quot;KeyName&quot;).CommandSpecificToObject

Using late binding like this means a performance hit of course, so if this is a concern, maybe you can work some sort of interface scheme up, have your objects implement that and have the Item() property or method return a reference to that instead.

Regards, [sig]<p>Russ<br><a href=mailto:bobbitts@hotmail.com>bobbitts@hotmail.com</a><br><a href= is in</a><br>[/sig]
 
I currently use a collection of 79 items, so I am not sure how badly a performance hit will affect me, since it's on an ASP (using an ActiveX dll to handle the collection for my ASP) [sig]<p>Karl<br><a href=mailto:kb244@kb244.com>kb244@kb244.com</a><br><a href= </a><br>Experienced in : C++(both VC++ and Borland),VB1(dos) thru VB6, Delphi 3 pro, HTML, Visual InterDev 6(ASP(WebProgramming/Vbscript)<br>
[/sig]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top