Appendix B - Variant Types

[This is preliminary documentation and subject to change.]

Data Type Member VARTYPE
unsigned char bVal VT_UI1
short iVal VT_I2
long lVal VT_I4
float fltVal VT_R4
double dblVal VT_R8
VARIANT_BOOL bool VT_BOOL
SCODE scode VT_ERROR
CY cyVal VT_CY
DATE date VT_DATE
BSTR bstrVal VT_BSTR
LPUNKNOWN punkVal VT_UNKNOWN
LPDISPATCH pdispVal VT_DISPATCH
SAFEARRAY * parray VT_ARRAY|*
unsigned char * pbVal VT_BYREF|VT_UI1
short * piVal VT_BYREF|VT_I2
long * plVal VT_BYREF|VT_I4
float * pfltVal VT_BYREF|VT_R4
double * pdblVal VT_BYREF|VT_R8
VARIANT_BOOL * pbool VT_BYREF|VT_BOOL
SCODE * pscode VT_BYREF|VT_ERROR
CY * pcyVal VT_BYREF|VT_CY
DATE * pdate VT_BYREF|VT_DATE
BSTR * pbstrVal VT_BYREF|VT_BSTR
LPUNKNOWN * ppunkVal VT_BYREF|VT_UNKNOWN
LPDISPATCH * ppdispVal VT_BYREF|VT_DISPATCH
SAFEARRAY ** pparray VT_BYREF|VT_ARRAY|*
VARIANT * pvarVal VT_BYREF|VT_VARIANT

In addition to the tag and arm, the VARIANTARG contains additional reserved members to properly align the arm on 8-byte boundaries (to support efficient copying of 8-byte doubles); these members (along with any unused bytes in the arm) must be properly initialized with the VariantInit API. Once initialized, the tag and arm of each VARIANTARG are assigned the proper values. It is important to note that arguments are stored in the array in right to-left order. The DISPPARAMS structure bundles the VARIANTARG array with an array of DISPIDs that correspond to the names of each argument.

typedef struct tagDISPPARAMS {
// Array of arguments
    VARIANTARG FAR* rgvarg;
// DISPIDS of named arguments
    DISPID FAR* rgdispidNamedArgs;
// Number of arguments
    unsigned int cArgs; 
// Number of named arguments
    unsigned int cNamedArgs; 
} DISPPARAMS;