• Two ActiveX with passing a variant array

    From R.Wieser@21:1/5 to All on Sun Jan 3 19:43:07 2021
    Hello all,

    From within some vbscript I'm calling a method in a simple ActiveX object, providing it a two-dimensional array, and have two problems :

    1) How to I define, in the TypeLib (IDL) file, that I want to pass a
    (pointer to a) variant array ? Currently I have this :

    HRESULT VarArray([in] variant* Array);

    The thing is that this causes the VarArray method to receive a variant which
    in turn holds a pointer to the Array, instead of just receiving a simple pointer to the Array.

    2) For some reason the above mentioned received variant has the pointer to
    the Array in bytes 0x0C...0x0F of the VARIANT structure, instead of in bytes 0x08...0x0B (as described here : https://docs.microsoft.com/en-us/windows/win32/api/oaidl/ns-oaidl-variant ), and I've got no idea why.

    The used OS version is XPsp3

    Regards,
    Rudy Wieser

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From R.Wieser@21:1/5 to R.Wieser on Sun Jan 3 22:05:29 2021
    "R.Wieser" <address@not.available> wrote in message news:rst386$gci$1@gioia.aioe.org...
    Hello all,
    ...
    2) For some reason the above mentioned received variant has the pointer to the Array in bytes 0x0C...0x0F of the VARIANT structure, instead of in
    bytes 0x08...0x0B

    It turns out that the bytes 0x08...0x0B are a pointer to the address holding the pointer to the array - in this case pointing to the bytes at
    0x0C...0x0F.

    No idea (yet) why its a pointer-to-a-pointer, but that is how it works.

    Currently only question #1 remains : what do I need to put into the TypeLib file to get a simple pointer to the, in the script provided, array. So
    that I do can skip the part checking the (what I now get) variant for its
    type and pointer-to-pointer contents.

    Regards,
    Rudy Wieser

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From JJ@21:1/5 to R.Wieser on Mon Jan 4 15:02:28 2021
    On Sun, 3 Jan 2021 19:43:07 +0100, R.Wieser wrote:
    Hello all,

    From within some vbscript I'm calling a method in a simple ActiveX object, providing it a two-dimensional array, and have two problems :

    1) How to I define, in the TypeLib (IDL) file, that I want to pass a
    (pointer to a) variant array ? Currently I have this :

    HRESULT VarArray([in] variant* Array);

    The thing is that this causes the VarArray method to receive a variant which in turn holds a pointer to the Array, instead of just receiving a simple pointer to the Array.

    2) For some reason the above mentioned received variant has the pointer to the Array in bytes 0x0C...0x0F of the VARIANT structure, instead of in bytes 0x08...0x0B (as described here : https://docs.microsoft.com/en-us/windows/win32/api/oaidl/ns-oaidl-variant ), and I've got no idea why.

    The used OS version is XPsp3

    Regards,
    Rudy Wieser

    You'll have to define a custom COM Record type to represent the raw array,
    then use that as the method arguments.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From R.Wieser@21:1/5 to All on Mon Jan 4 09:48:41 2021
    JJ,

    You'll have to define a custom COM Record type to represent
    the raw array, then use that as the method arguments.

    Whoah ... Thats an area I've never worked in ... For now I think I'm going
    to pass on that.

    As for "the raw" data, the conversion works flawlessly for variants that are received as longs, booleans, bstr's, etc. (including silent type
    conversions). I would assume that "extracting" (if you can even call it
    that) a SafeArray from the provided vbs array and receive that could/would
    work the same way.

    Looking at what I have to do to extract the SaveArray myself it doesn't look like rocket science. Am I perhaps missing something there ?

    Regards,
    Rudy Wieser

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)