Jump to content

Using an Array of COM objects


Angel
 Share

Recommended Posts

Hi,

I need to make an array of COM objects. According to the documentation COM objects are in fact pointers which are stored in an autoit variant. If that is the case it would seem that it is save to create an array of COM objects right?

Then I have 2 questions:

1. Is it safe and allowed to use the "With" statement with an array alement which is a COM object? For instance:

With $vComArray[0]
...
EndWith
; Where $vComArray[0] is a COM object
oÝ÷ Ûb!«,   èê¶éÛ(^jºÚÊÚö«¦åzåÊØ^¦§µêâ±Ê)çkmJ0¢é].ëajØ!ÈZ*¶©®^®Ø²íêç-jwb·
.ÖÞ­çåyË^-)íæ«­¬éÖ§v)íéhq©oj¸nW²ØZµÊ+­ç-âËZǺÚ"µÍÈ   ÌÍÝÛÛP^HÛÛZ[ÈÓÓHØXÝÂØØ[^PÛÛSØH    ÌÍÝÛÛP^VÌWHÈÜÚYÛHÙXÛÛØXÝÈHØØ[^B^PÛÛSØ^TÜHHÈÈÝÈ    ÌÍÝÛÛP^VÌWK^TÜHÈÈÈÙ[

I could not figure out these for sure from the COM reference. Please forgive me if it is clear and I just did not understand it. I am going to try these on my own, but as these deals with pointers I want to make sure that what I am doing is correct.

Thank you in advance,

Angel

Link to comment
Share on other sites

I saw that you added this earlier today, and I was wondering if you found out the answer?

Have you tried to do an array of COM objects and have it fail, or were you just curious?

Actually, I just tried it and I discovered two things:

1. You cannot use "With" with array elements, even if those are COM objects

2. You can have an array of COM objects, even if they are of the same type

3. When you do assign an element of an array which is a COM object to a variable, you are copying a reference, and whaterver you change on the copy is changed in the original as well. However, if you then assign something else to the variable (like 0, for instance) you do not destroy the COM object (the element in the array is still valid).

I hope this helps you!

Angel

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...