Data Types for Variants, Safe Arrays, and Properties
- Updated2023-02-21
- 2 minute(s) read
A set of fundamental data types exists that is valid for variants, safe arrays, and properties. You can apply a set of modifiers to these fundamental data types to create more data types. Not all combinations of data types and modifiers are valid in all cases. The function descriptions specify which data types are valid in particular contexts. The following table shows the fundamental data types.
Fundamental Data Types for Variants, Safe Arrays, and Properties
Defined Constant | Data Type or Meaning |
---|---|
CAVT_EMPTY | Variant contains nothing |
CAVT_NULL | Variant contains NULL value |
CAVT_SHORT | short |
CAVT_LONG | long |
CAVT_INT | int (same as CAVT_LONG) |
CAVT_FLOAT | float |
CAVT_DOUBLE | double |
CAVT_CY | CURRENCY (Windows SDK data type) |
CAVT_DATE | DATE (Windows SDK data type) |
CAVT_BSTR | BSTR (Windows SDK data type) |
CAVT_DISPATCH | LPDISPATCH (ActiveX data type for an ActiveX object interface) |
CAVT_ERROR | SCODE (Windows SDK data type) |
CAVT_BOOL | VBOOL, which maps to VARIANT_BOOL (ActiveX data type) |
CAVT_VARIANT | VARIANT (ActiveX data type) |
CAVT_UNKNOWN | LPUNKNOWN (ActiveX data type for an unknown interface) |
CAVT_UCHAR | unsigned char |
CAVT_CHAR | char |
CAVT_USHORT | unsigned short |
CAVT_ULONG | unsigned long |
CAVT_UINT | unsigned int (same as CAVT_ULONG) |
CAVT_LONGLONG | long long |
CAVT_ULONGLONG | unsigned long long |
CAVT_CSTRING | char * (null-terminated string) |
CAVT_OBJHANDLE | CAObjHandle, which maps to void * |
You can bitwise OR all the constants in the Fundamental Data Types for Variants, Safe Arrays, and Properties table, except for CAVT_EMPTY and CAVT_NULL, with the data type modifiers. The following table shows the data type modifiers.
Data Type Modifiers for Variants, Safe Arrays, and Properties
Defined Constant | Meaning |
CAVT_ARRAY | Array of data type. For example, CAVT_SHORT | CAVT_ARRAY signifies an array of short integers. |
CAVT_BYREF | Pointer to data type. |
CAVT_BYREFI | Pointer to data type. Input-only parameter you pass by reference. Defined as CAVT_BYREF | CAVT_IN. |
CAVT_BYREFO | Pointer to data type. Output-only parameter you pass by reference. Defined as CAVT_BYREF | CAVT_OUT. |
CAVT_BYREFIO | Pointer to data type. Input-output parameter you pass by reference. Defined as CAVT_BYREF | CAVT_IN | CAVT_OUT. |
To pass a pointer to the array address, use CAVT_ARRAY and one of the CAVT_BYREF modifiers.