Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

VARIANT structure

VARIANTARG describes arguments passed within DISPPARAMS, and VARIANT to specify variant data that cannot be passed by reference.

When a variant refers to another variant by using the VT_VARIANT | VT_BYREF vartype, the variant being referred to cannot also be of type VT_VARIANT | VT_BYREF. VARIANTs can be passed by value, even if VARIANTARGs cannot.

Syntax


typedef struct tagVARIANT {
  union {
    struct __tagVARIANT {
      VARTYPE vt;
      WORD    wReserved1;
      WORD    wReserved2;
      WORD    wReserved3;
      union {
        LONGLONG            llVal;
        LONG                lVal;
        BYTE                bVal;
        SHORT               iVal;
        FLOAT               fltVal;
        DOUBLE              dblVal;
        VARIANT_BOOL        boolVal;
        _VARIANT_BOOL       bool;
        SCODE               scode;
        CY                  cyVal;
        DATE                date;
        BSTR                bstrVal;
        IUnknown            *punkVal;
        IDispatch           *pdispVal;
        SAFEARRAY           *parray;
        BYTE                *pbVal;
        SHORT               *piVal;
        LONG                *plVal;
        LONGLONG            *pllVal;
        FLOAT               *pfltVal;
        DOUBLE              *pdblVal;
        VARIANT_BOOL        *pboolVal;
        _VARIANT_BOOL       *pbool;
        SCODE               *pscode;
        CY                  *pcyVal;
        DATE                *pdate;
        BSTR                *pbstrVal;
        IUnknown            **ppunkVal;
        IDispatch           **ppdispVal;
        SAFEARRAY           **pparray;
        VARIANT             *pvarVal;
        PVOID               byref;
        CHAR                cVal;
        USHORT              uiVal;
        ULONG               ulVal;
        ULONGLONG           ullVal;
        INT                 intVal;
        UINT                uintVal;
        DECIMAL             *pdecVal;
        CHAR                *pcVal;
        USHORT              *puiVal;
        ULONG               *pulVal;
        ULONGLONG           *pullVal;
        INT                 *pintVal;
        UINT                *puintVal;
        struct __tagBRECORD {
          PVOID       pvRecord;
          IRecordInfo *pRecInfo;
        } __VARIANT_NAME_4;
      } __VARIANT_NAME_3;
    } __VARIANT_NAME_2;
    DECIMAL             decVal;
  } __VARIANT_NAME_1;
} VARIANT, *LPVARIANT, VARIANTARG, *LPVARIANTARG;

Members

__VARIANT_NAME_1
__VARIANT_NAME_2

Type: struct __tagVARIANT

vt

Type: VARTYPE

The type of data in the union.

wReserved1

Type: WORD

Reserved.

wReserved2

Type: WORD

Reserved.

wReserved3

Type: WORD

Reserved.

__VARIANT_NAME_3
llVal

Type: LONGLONG

An 8-byte integer value.

lVal

Type: LONG

A 4-byte integer value.

bVal

Type: BYTE

An unsigned 1-byte character.

iVal

Type: SHORT

A 2-byte integer value.

fltVal

Type: FLOAT

A 4-byte real value.

dblVal

Type: DOUBLE

An 8-byte real value.

boolVal

Type: VARIANT_BOOL

A 16-bit Boolean value. A value of 0xFFFF (all bits 1) indicates true; a value of 0 (all bits 0) indicates false. No other values are valid.

bool

Type: _VARIANT_BOOL

A 16-bit Boolean value. A value of 0xFFFF (all bits 1) indicates true; a value of 0 (all bits 0) indicates false. No other values are valid.

scode

Type: SCODE

An SCODE value.

cyVal

Type: CY

A currency value.

date

Type: DATE

A date and time value. Dates are represented as double-precision numbers, where midnight, January 1, 1900 is 2.0, January 2, 1900 is 3.0, and so on.

The date can be converted to and from an MS-DOS representation using VariantTimeToDosDateTime.

bstrVal

Type: BSTR

A string value.

punkVal

Type: IUnknown*

A pointer to an object that implements the IUnknown interface.

pdispVal

Type: IDispatch*

A pointer to an object was specified.

parray

Type: SAFEARRAY*

A safe array descriptor, which describes the dimensions, size, and in-memory location of the array.

pbVal

Type: BYTE*

A reference to an unsigned 1-byte character.

piVal

Type: SHORT*

A reference to a 2-byte integer value.

plVal

Type: LONG*

A reference to a 4-byte integer value.

pllVal

Type: LONGLONG*

A reference to an 8-byte integer value.

pfltVal

Type: FLOAT*

A reference to a 4-byte real value.

pdblVal

Type: DOUBLE*

A reference to an 8-byte real value.

pboolVal

Type: VARIANT_BOOL*

A reference to a 16-bit Boolean value.

pbool

Type: _VARIANT_BOOL*

A reference to a 16-bit Boolean value.

pscode

Type: SCODE*

A reference to an SCODE value.

pcyVal

Type: CY*

A reference to a currency value.

pdate

Type: DATE*

A reference to a date and time value. Dates are represented as double-precision numbers, where midnight, January 1, 1900 is 2.0, January 2, 1900 is 3.0, and so on.

pbstrVal

Type: BSTR*

A reference to a string value.

ppunkVal

Type: IUnknown**

A reference to an IUnknown interface pointer.

ppdispVal

Type: IDispatch**

A reference to an object pointer.

byref

Type: PVOID

A generic value.

cVal

Type: CHAR

A 1-byte character value.

uiVal

Type: USHORT

An unsigned 2-byte integer value.

ulVal

Type: ULONG

An unsigned 4-byte integer value.

ullVal

Type: ULONGLONG

An unsigned 8-byte integer value.

intVal

Type: INT

An integer value.

uintVal

Type: UINT

An unsigned integer value.

pdecVal

Type: DECIMAL*

A decimal value, which is stored as 96-bit (12-byte) unsigned integers scaled by a variable power of 10.

pcVal

Type: CHAR*

A reference to a 1-byte character value.

puiVal

Type: USHORT*

A reference to an unsigned 2-byte integer value.

pulVal

Type: ULONG*

A reference to an unsigned 4-byte integer value.

pullVal

Type: ULONGLONG*

A reference to an unsigned 8-byte integer value.

pintVal

Type: INT*

A reference to an integer value.

puintVal

Type: UINT*

A reference to an unsigned integer value.

__VARIANT_NAME_4

Type: struct __tagBRECORD

pvRecord

Type: PVOID

A reference to a database record.

pRecInfo

Type: IRecordInfo*

A reference to a UDT.

decVal

Type: DECIMAL

A decimal value.

Requirements

Header

OaIdl.h

 

 

Community Additions

Show:
© 2015 Microsoft