Click to See Complete Forum and Search --> : how to pass a array


jiatiejun
July 2nd, 2001, 09:49 AM
I had a ATL class,
It has a method,
the method retrieves a array,
for examples:
MyMethod([in] VARIANT myArray)

it can't work
when I create instance follow:
Dim x as Object
Set x = CreateObject("MyObjectID")
Dim a(10)
X.MyMethod a

but it work normally follow:
Dim x as New MyObjectTypeLib.MyObjectID
Dim a(10)
X.MyMethod a

Why?

Who can help me?

Thanks

jiatiejun

Alex Fedotov
July 2nd, 2001, 10:25 AM
Check the type of the variant that is passed in using the first method.
Chances are it is VT_BYREF|VT_VARIANT, so you should "dereference" it
using VariantCopyInd function.