Admin Production ni-theme
Current Publication

CA_VariantSet2DArray

LabWindows/CVI

CA_VariantSet2DArray

HRESULT CA_VariantSet2DArray (VARIANT *variant, unsigned int arrayType, size_t sizeOfDim1, size_t sizeOfDim2, const void *array);

Purpose

Creates a safe array from a 2D array and stores the safe array in a variant.

Note   Use CA_VariantClear to free the safe array stored in the variant.

Parameters

Input
Name Type Description
arrayType unsigned int Data type of array.

arrayType can contain any of the fundamental data types for variants, safe arrays, and properties except CAVT_EMPTY, CAVT_NULL, and CAVT_OBJHANDLE.
sizeOfDim1 size_t Number of elements in the first dimension of array.

An error is returned if you pass a value greater than UINT_MAX.
sizeOfDim2 size_t Number of elements in the second dimension of array.

An error is returned if you pass a value greater than UINT_MAX.
array const void * 2D array that CA_VariantSet2DArray converts to a safe array.

This array can contain any one of the following types: long, short, float, double, VBOOL, char* (NULL terminated string), unsigned char, BSTR, DATE, CURRENCY, LPUNKNOWN, LPDISPATCH, SCODE, VARIANT.

Note    CA_VariantSet2DArray does not make copies of BSTR, VARIANT, LPUNKNOWN, or LPDISPATCH elements. CA_VariantSet2DArray copies the pointers into the created safe array. When you call CA_VariantClear, which frees the safe array and all its contents, the BSTR, VARIANT, LPUNKNOWN, or LPDISPATCH elements of the input array parameter become invalid.
Output
Name Type Description
variant VARIANT Variant to which CA_VariantSet2DArray assigns the safe array.

Return Value

Name Type Description
status HRESULT A value indicating whether an error occurred. Negative error codes indicate function failure.

Error codes are defined in CVIversion\include\cviauto.h and <Program Files>\National Instruments\Shared\MSDTRedistributables\SDKHeaderFiles\8.1\winerror.h. The LabWindows/CVI ActiveX Library explicitly returns error codes. Other error codes in winerror.h are generated by ActiveX servers and passed on to you by the LabWindows/CVI ActiveX Library.

You can use CA_GetAutomationErrorString to get the description of an error code or CA_DisplayErrorInfo to display the description of the error code.

Additional Information

Library: ActiveX Library

Include file: cviauto.h

LabWindows/CVI compatibility: LabWindows/CVI 5.0 and later

Examples

Refer to the following examples that use the CA_VariantSet2DArray function:

  • userint\activex\3DGraph.cws

    Open example
  • userint\activex\3DGraphAxis.cws

    Open example
  • userint\activex\3DGraphColorMap.cws

    Open example
  • userint\activex\3DGraphContours.cws

    Open example