The following table shows the documented values of the
enumeration, defined in <wtypes.h>.VARENUM
Struct fields which are intended to contain one of these values are conventionally of type VARTYPE (unsigned short).
| enum member | value | description | commentary |
|---|---|---|---|
| VT_EMPTY | 0x0000 | Not specified. | Emptydoes not meant empty, it means unknown. |
| VT_NULL | 0x0001 | Null. | Empty, i.e. holding no value. |
| VT_I2 | 0x0002 | A 2-byte integer. | The exact language type expected is not stated. If multiple types are used, user code must be careful to conduct explicit lifetime management so as to avoid aliasing violations. |
| VT_I4 | 0x0003 | A 4-byte integer. | |
| VT_R4 | 0x0004 | A 4-byte real. | Presumably binary floating point. |
| VT_R8 | 0x0005 | An 8-byte real. | Win32 does not provide a typedef for this width. Use either a double, or _Float64. |
| VT_CY | 0x0006 | Currency. | Used with the CY struct. |
| VT_DATE | 0x0007 | A date. | |
| VT_BSTR | 0x0008 | A string. | |
| VT_DISPATCH | 0x0009 | An IDispatch pointer. | |
| VT_ERROR | 0x000A | An SCODE value. | An SCODE is apparently the same type as a HRESULT. It is unclear when to use one or the other. |
| VT_BOOL | 0x000B | A Boolean value. True is -1 and false is 0. | Used with VARIANT_BOOL. Do not use BOOL, as the value representation is not the same. |
| VT_VARIANT | 0x000C | A variant pointer. | Likely ill-advised to place a variant inside a variant. |
| VT_UNKNOWN | 0x000D | An IUnknown pointer. | |
| VT_DECIMAL | 0x000E | A 16-byte fixed-point value. | Used with the DECIMAL structure. Ill-advised to use anything else. |
| VT_I1 | 0x0010 | A character. | Presumably CHAR. |
| VT_UI1 | 0x0011 | An unsigned character. | Presumably UCHAR. |
| VT_UI2 | 0x0012 | An unsigned short. | |
| VT_UI4 | 0x0013 | An unsigned long. | Use only ULONG for this; it is only long on LLP64. Do not use unsigned long directly. |
| VT_I8 | 0x0014 | A 64-bit integer. | Do not use LONGLONG for this; that is actually a double on x86. Use either INT64 or int64_t. |
| VT_UI8 | 0x0015 | A 64-bit unsigned integer. | Do not use ULONGLONG for this; that is actually a double on x86. Use either UINT64 or uint64_t. |
| VT_INT | 0x0016 | An integer. | Presumably INT. |
| VT_UINT | 0x0017 | An unsigned integer. | Presumably UINT. |
| VT_VOID | 0x0018 | A C-style void. | Use is unclear. |
| VT_HRESULT | 0x0019 | An HRESULT value. | |
| VT_PTR | 0x001A | A pointer type. | |
| VT_SAFEARRAY | 0x001B | A safe array. Use VT_ARRAY in VARIANT. | It is unclear why there is both VT_ARRAY and VT_SAFEARRAY. |
| VT_CARRAY | 0x001C | A C-style array. | Can be used only on a TYPEDESC. |
| VT_USERDEFINED | 0x001D | A user-defined type. | Can be used only on a property set. |
| VT_LPSTR | 0x001E | A null-terminated string. | Presumably an LPSTR, which is a string of CHAR. |
| VT_LPWSTR | 0x001F | A wide null-terminated string. | LPWSTR, which is a string of WCHAR_T. |
| VT_RECORD | 0x0024 | A user-defined type. | Actually a pointer to an IRecordInfo. |
| VT_INT_PTR | 0x0025 | A signed machine register size width. | I have no idea why it is phrased like that. |
| VT_UINT_PTR | 0x0026 | An unsigned machine register size width. | |
| VT_FILETIME | 0x0040 | A FILETIME value. | |
| VT_BLOB | 0x0041 | Length-prefixed bytes. | The first 4 bytes must be a little-endian unsigned integer containing the size of the subsequent array. |
| VT_STREAM | 0x0042 | The name of the stream follows. | |
| VT_STORAGE | 0x0043 | The name of the storage follows. | |
| VT_STREAMED_OBJECT | 0x0044 | The stream contains an object. | |
| VT_STORED_OBJECT | 0x0045 | The storage contains an object. | |
| VT_BLOB_OBJECT | 0x0046 | The blob contains an object. | See VT_BLOB. |
| VT_CF | 0x0047 | A clipboard format. | |
| VT_CLSID | 0x0048 | A class ID. | |
| VT_VERSIONED_STREAM | 0x0049 | A stream with a GUID version. | |
| VT_BSTR_BLOB | 0x0FFF | Reserved. | Value of member liable to change. Do not use. |
| VT_VECTOR | 0x1000 | A simple counted array. | Not to be confused with VT_CARRAY. |
| VT_ARRAY | 0x2000 | A SAFEARRAY pointer. | Not to be confused with VT_SAFEARRAY. |
| VT_BYREF | 0x4000 | A void pointer for local use. | Usable only on a VARIANT. Must be bitor’d with a lower value to indicate that the argument is to be modified by the invoked automation method. |
| VT_RESERVED | 0x8000 | No description. | Presumably reserved. |
| VT_ILLEGAL | 0xFFFF | ||
| VT_ILLEGALMASKED | 0x0FFF | ||
| VT_TYPEMASK | 0x0FFF | ||
| VT_BYREF_TYPEMASK | 0x4FFF | Not documented. | Values not present on enum definition: only used internally. See VT_BYREF. |
| VT_BYREF_VARIANT | 0x400C |
The following table shows where these values can be used.
| Value | VARIANT | TYPEDESC | Property set | Safe array |
|---|---|---|---|---|
| VT_ARRAY | X | |||
| VT_BLOB | X | |||
| VT_BLOB_OBJECT | X | |||
| VT_BOOL | X | X | X | X |
| VT_BSTR | X | X | X | X |
| VT_BSTR_BLOB | ||||
| VT_BYREF | X | |||
| VT_CARRAY | X | |||
| VT_CF | X | |||
| VT_CLSID | X | |||
| VT_CY | X | X | X | X |
| VT_DATE | X | X | X | X |
| VT_DECIMAL | X | X | X | |
| VT_DISPATCH | X | X | X | |
| VT_EMPTY | X | X | ||
| VT_ERROR | X | X | X | X |
| VT_FILETIME | X | |||
| VT_HRESULT | X | |||
| VT_I1 | X | X | X | X |
| VT_I2 | X | X | X | X |
| VT_I4 | X | X | X | X |
| VT_I8 | X | X | ||
| VT_INT | X | X | X | X |
| VT_INT_PTR | X | |||
| VT_LPSTR | X | X | ||
| VT_LPWSTR | X | X | ||
| VT_NULL | X | X | ||
| VT_PTR | X | |||
| VT_R4 | X | X | X | X |
| VT_R8 | X | X | X | X |
| VT_RECORD | X | X | X | |
| VT_SAFEARRAY | X | |||
| VT_STORAGE | X | |||
| VT_STORED_OBJECT | X | |||
| VT_STREAM | X | |||
| VT_STREAMED_OBJECT | X | |||
| VT_UI1 | X | X | X | X |
| VT_UI2 | X | X | X | X |
| VT_UI4 | X | X | X | X |
| VT_UI8 | X | X | ||
| VT_UINT | X | X | X | |
| VT_UINT_PTR | X | |||
| VT_UNKNOWN | X | X | X | |
| VT_USERDEFINED | X | |||
| VT_VARIANT | X | X | X | X |
| VT_VECTOR | X | |||
| VT_VERSIONED_STREAM | X | |||
| VT_VOID | X |