Search code examples
javascriptc++variantactivexobjectcloning

VARIANT cloning in ActiveX


I'm programming an application in javascript which uses activeX object.
The ActiveX function gets a VARIANT parameter from javascript call.

If I define a global variable named *V1 and compare it to the get variable, like this:

V1 = &variant;

It doesn't work because the data lost after function ends.
How can I clone the variant safely and easily?


Solution

  • Use VariantCopy function (link)

    VARIANT v1;
    VariantCopy(&v1, &variant);