09-16-2002 11:25 AM
09-19-2002 05:44 PM
10-11-2002 08:09 PM
10-07-2008 03:35 PM
Hi,
I had the same problem while passing an array from VBScript (written in Notepad) to my COM Server written as a Local Server (EXE).
My IDL file looks like this:
[id(2)] HRESULT ReadVar ([in] VARIANT *, [in, out] VARIANT *);
When I tried to access the array using CA_VariantGet1DArray() and CA_VariantSet1DArray() I got error codes from these functions.
I found out that the following works perfectly:
1) Call CA_VariantGetSafeArrayPtr() to get a pointer to the safearray inside the variant
2) Call regular Win32 safearray manipulation functions to access the safearray data
3) You can optionally call CA_SafeArrayTo1DArrayEx() with flag CVIAUTO_RETAIN_SAFEARRAY set so the safearray contents be kept inside the variant. You will get a C style array where you can play with the data.
Hope it helps