VARIANT type

hi,

i need to pass in a VARIANT type to a function and i have no idea how to initialse the VARIANT type. how do i initalize the variant to contains an array of unsigned long?

thank you
xstarAsked:
Who is Participating?
 
vadikConnect With a Mentor Commented:
Try this way:

     VARIANT v;
     long arLong[10] = { 0 };

     VariantInit(&v); // Initialization of VARIANT

     v.vt = VT_BYREF | VT_I4; // Type of variant (pointer to long, long FAR * plVal;
     v.plVal = &arLong[0]; // Assignment

        SomeFunc(v); // void SomeFunc(VARIANT&)

     VariantClear(&v);
0
 
HermeticCommented:
Do you need a Variant of the type "array of longs"?
or
a Variant of type variant array of longs?
or
a variant of type variant array (safearray) of longs?

Did I mention I hate Variants?
0
All Courses

From novice to tech pro — start learning today.