Measurement Studio for VC++

cancel
Showing results for 
Search instead for 
Did you mean: 

Variant array

Does anyone know how to create a VARIANT array in Visual C++? The following parameter is part of the FillImage2 method and I'm having trouble creating a 1D array of type Variant. Any insight will be appreciated!

RGBU64 As Variant

[Optional] A 1D array with 4 integer elements (the red, green, blue, and alpha planes) used to fill RGBU64 images.

Thanks
0 Kudos
Message 1 of 2
(3,446 Views)
Looks like you need a VARIANT that contains a SAFEARRAY. Try this


int data[4]= {1,2,3,4};

COleSafeArray sa;
//Populate SafeArray with an array of int
sa.CreateOneDim(VT_I4, 4, data);

VARIANT* myVariant = ((LPVARIANT)sa);

Im assuming you have MFC support in your project. For more information, refer to the ColeSafeArray help on the MSDN.

Hope this helps
Bilal Durrani
NI
0 Kudos
Message 2 of 2
(3,431 Views)