Table 3.1

 

Available Variant types

 

VT-Type

VT-Constant value

Type of the value

contained in the Variant

(field used to access the value)

Equivalent Fortran

Type

VT_EMPTY

0

Empty variant[5]

none

VT_NULL

1

Null Variant[6]

none

VT_I2

2

2-byte signed integer (iVal)

Integer(SHORT_KIND)

VT_I4

3

4-byte signed integer (lVal)

Integer(LONG_KIND)

VT_R4

4

4-byte real (fltVal)

Real(REAL_KIND)

VT_R8

5

8-byte real (dblVal)

Real(DOUBLE_KIND)

VT_CY

6

Currency record (cyVal)

type CURRENCY

     sequence

     integer(LONG_KIND)::Lo

     integer(LONG_KIND)::Hi

end type CURRENCY

VT_DATE

7

Date (8-byte real) (dateVal)

Real(DOUBLE_KIND)

VT_BSTR

8

Bstring Handle (bstrVal)

Integer(BSTRHNDL_KIND)

VT_DISPATCH

9

IDispatch Handle (pdispVal)

Integer(IDISPATCH_KIND)

VT_ERROR

10

4-byte integer  (scodeVal)

Integer(LONG_KIND)

VT_BOOL

11

True=-1, False=0 (2-byte integer)

(boolVal)

Integer(SHORT_KIND)

VT_VARIANT[7]

12

Pointer to a Variant record (pvarVal)

Integer(POINTER_KIND)

VT_UNKNOWN

13

IUnknown Handle (punkVal)

Integer(IUNKNOWN_KIND)

VT_DECIMAL

14

16-byte fixed point decimal

structure

type DECIMAL

sequence

integer(SHORT_KIND)::wReserved

integer(BYTE_KIND)::scale

integer(BYTE_KIND)::sign

integer(LONG_KIND)::Hi32

integer(LONG_KIND)::Lo32

integer(LONG_KIND):: Mid32

end type DECIMAL

VT_I1

16

Signed character (cVal)

Integer(BYTE_KIND)

VT_UI1

17

Unsigned character (ubVal)

Integer(BYTE_KIND)[8]

VT_UI2

18

Unsigned 2 byte integer (uiVal)

Integer(SHORT_KIND)[21]

VT_UI4

19

Unsigned 4 byte integer (ulVal)

Integer(LONG_KIND)[21]

VT_I8[24]

20

Signed 8-byte integer

 

VT_UI8[9]

21

Unsigned 8-byte integer

 

VT_INT

22

Signed 4-byte integer (intVal)

Integer(LONG_KIND)[21]

VT_UINT

23

Unsigned 4-byte integer (uintVal)

Integer(LONG_KIND)[21]

VT_VOID

24

C-Style Void (byref)

Integer(LONG_KIND)

VT_HRESULT

25

OLE/COM return type (scodeVal)

Integer(LONG_KIND)

VT_PTR

26

Pointer type (byref)

Integer(LONG_KIND)

VT_SAFEARRAY[10]

27

Safe Array Handle

Integer(SAFEARRAY_KIND)

VT_CARRAY

28

C-style Array Handle (pArray)

Integer(POINTER_KIND)

VT_USERDEFINED[27]

29

User Defined Type (UDT)

 

VT_LPSTR

30

Pointer to a null-terminated

ANSI string (byref)

Integer(POINTER_KIND)

VT_LPWSTR

31

Pointer to a null-terminated

UNICODE string (byref)

Integer(POINTER_KIND)

VT_RECORD[11]

36

User Defined Type (UDT)

 

VT_CLSID

72

Pointer to a CLSID

Integer(POINTER_KIND)

VT_VECTOR[12]

4096

Mask used to indicate that the Variant contains a C-style vector of the indicated VT-Type. Value stored in the Variant is a pointer to the vector.

 

VT_ARRAY

8192

Mask used to indicate that the Variant contains a Safe Array of the indicated VT-Type. Value stored in the Variant is a pointer to the Safe Array descriptor.

 

VT_BYREF

16384

 

 

 

 

 

Table Notes:

5. Un-initialized variants, i.e. variants that have not been assigned a value, have this VT-Type.

6. Variants can have this type, indicating that they contain a NULL value.

7. Can only appear in conjunction with VT_VECTOR, VT_ARRAY or VT_BYREF

8. Fortran does not handle unsigned integers, however, in most cases you can use a signed integer to hold the value of an unsigned integer. If the unsigned integer uses its most significant byte, then the value would appear as a negative quantity when handled as a signed integer.

9. Not supported in this version of f90VB.

10. Do not use this VT-Type to indicate a Variant that contains a Safe Array, instead use the VT_ARRAY modifier.

11. Variants with records and User-Defined Types (UDTs) are not directly supported by f90VB, however, you can implement them manually.

12. VT_VECTOR, VT_ARRAY and VT_BYREF are not real VT-Types. Rather, they are used in conjunction with base VT-Types to indicate that the variant contains a C-style vector, a Safe Array or a value by reference