PDA

Click to See Complete Forum and Search --> : ActiveX - passing controls??


Acoustic
May 24th, 2001, 05:51 PM
I've got a dll I've been working on that performs a couple functions based on different properties. All is well and good...but what I need to do now is somehow pass a listview (or the contents thereof) to the activex dll...(the listview is report style with small icons in the first column). Once I get that to work I've already got the code to do what is needed with the various subitems of the control, but I don't have any experience with passing controls to dll, nor do I even know if it's possible.

I realize that I could take the text from the listview and put it into an array and pass the array, but then I won't have access to the listview's properties such as icons, smallicons etc...

Please help me out with a bit of code & suggestions if you have any!

Thanks,
Acoustic

eer3
May 25th, 2001, 04:59 PM
I'm pretty sure that you can, though I'm not sure what you would do with it from there, but it seems as though you've already got that part figured out anyhow. Use the Let and Get Properties to pass the object. Then set a reference = to the object in the Let property.

This example uses a listbox, but I'm sure you could pass a ListView control as well.

'Put this in your exe project
Private Sub CommandButton1_Click()
'You'll need a reference to your DLL here, made with createobject..
'or however you already reference it... I'll assume that you have
'that reference and it is called MyDLLRef
MyDLLRef.MyObject(ListBox1) = "ListBox1 Object"
End Sub


'Put this in your DLL
Public Property Get MyObject(objLSV As Object) As Variant

End Property

Public Property Let MyObject(ByRef objLSB As Object, ByVal vNewValue As Variant)

Dim objNewLSB As Object
Set objNewLSB = objLSB

'Now all properties of the Listbox can be made with objNewLSB
End Property