Admin Production ni-theme
Current Publication

DS_GetDataType

LabWindows/CVI

DS_GetDataType

HRESULT DS_GetDataType (DSHandle DSHandle, unsigned int *type, unsigned int *dimension1, unsigned int *dimension2);

Purpose

Returns the type of the DataSocket object's data value.

If the DataSocket object's data value is an array, this function also returns the dimensions of the array. If the DataSocket object's data value is a string, this function returns the length of the string.

Parameters

Input
Name Type Description
DSHandle DSHandle Pass the handle you obtained from DS_Open, DS_GetAttrHandle, or DS_CreateAttrHandle to identify the DataSocket object.
Output
Name Type Description
type unsigned int Returns a constant that indicates the type of the DataSocket object's data value.

Pass NULL if you do not want this information.

The data value can be one of the valid types or an array of one of the valid types other than CAVT_VARIANT. The following table lists the valid type constants and their corresponding C/Windows types:

Constant C/Windows type
CAVT_DOUBLE double
CAVT_FLOAT float
CAVT_LONG long
CAVT_SHORT short
CAVT_UCHAR unsigned char
CAVT_CSTRING char *
CAVT_BOOL short
CAVT_VARIANT VARIANT

If the DataSocket object's data value is an array of one of the valid types, this parameter returns a bitwise OR (|) of the type and the CAVT_ARRAY flag. You can use the following code to determine whether the data value is an array:

int isArray = (type & CAVT_ARRAY);

Note   This function returns the CAVT_VARIANT constant for the data type if the type of the DataSocket object's data value is not a valid ActiveX type. Some servers that use custom interfaces might support non-Automation data types, such as unsigned short and unsigned long.
dimension1 unsigned int Returns the length of the string if the type of the DataSocket object's data value is CAVT_CSTRING. The length does not include the terminating NUL byte.

Returns the number of elements in the array if the DataSocket object's data value is a 1D array of any type.

Returns the size of the first dimension of the array if the DataSocket object's data value is a 2D array of any type.

If the DataSocket object's data value is not a string or an array, the value returned is not defined.

Pass NULL if you do not want this value.
dimension2 unsigned int Returns the size of the second dimension of the array if the DataSocket object's data value is a 2D array of any type.

If the DataSocket object's data value is not a 2D array, the value returned is not defined.

Pass NULL if you do not want this value.

Return Value

Name Type Description
status HRESULT The value that indicates whether an error occurred. A negative error code indicates function failure.

Error codes are defined in CVIversion\toolslib\datasock\dataskt.h and <Program Files>\National Instruments\Shared\MSDTRedistributables\SDKHeaderFiles\8.1\winerror.h. Other error codes in winerror.h are generated by ActiveX Servers and are passed on to you by the DataSocket Library.

Additional Information

Library: DataSocket Library

Include file: datasock\dataskt.h

LabWindows/CVI compatibility: LabWindows/CVI 5.5 and later