When data moves from IDL to a COM object and back, IDL handles conversion of variable data types automatically. The data type mappings are shown below.

COM Type

IDL Type

BOOL (VT_BOOL)

Byte (true =1, false=0)

ERROR (VT_ERROR)

Long

CY (VT_CY)

Double (see note below)

DATE (VT_DATE)

Double

I1 (VT_I1)

Byte

INT (VT_INT)

Long

UINT (VT_UINT)

Unsigned Long

VT_USERDEFINED

The IDL type is passed through

VT_UI1

Byte

VT_I2

Integer

VT_UI2

Unsigned integer

VT_ERROR

Long

VT_I4

Long

VT_UI4

Unsigned Long

VT_I8

Long64

VT_UI8

Unsigned Long 64

VT_R4

Float

VT_BSTR

String

VT_R8

Double

VT_DISPATCH

IDLcomIDispatch

VT_UNKNOWN

IDLcomIDispatch

Note on the COM CY Data Type


The COM CY data type is a scaled 64-bit integer, supporting exactly four digits to the right of the decimal point. To provide an easy-to-use interface, IDL automatically scales the integer as part of the data conversion that takes place between COM and IDL, allowing the IDL user to treat the number as a double-precision floating-point value. When the value is passed back to the COM object, it will be truncated if there are more than four significant digits to the right of the decimal point.

For example, the IDL double-precision value 234.56789 would be passed to the COM object as 234.5678.