Jump to content

How to store Objects in an array ?


Recommended Posts

Hi,

I am using a COM Object from a dll (vncx.dll) and would like to store about 20 objects ($var = ObjCreate("VNCX.VNCViewer"))  in a 2 dimensional array.

It seems the return value of ObjCreate stored in the array is empty. Is it normal ?

Should I use another way ? I don't know how to keep track of this generated objects...

 

Thanks.

Link to comment
Share on other sites

It should work just like it does with a normal variable. You just have to indicate which position in the array you want to store the object, ie -

$var = ObjCreate("VNCX.VNCViewer"))

becomes

$myarray[0] = ObjCreate("VNCX.VNCViewer"))
$myarray[1] = ObjCreate("VNCX.VNCViewer"))

If you still have questions, show us your code so that we can see what you have tried thus far.

Link to comment
Share on other sites

EDIT : My bad, it works !

I was fooled by a COM error "Variable must be of type 'Object'" after reading an empty row of my array...

And _ArrayDisplay() is not able to show the value of this object (empty cell).

Thank you for your help !

Edited by tatane
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...