COM Types

 

 

 

 

COM functions allow you to specify a type for integer parameters. Normally, when you specify an integer value as a parameter to a COM function, WIL passes it as a type VT_I4 (4-byte integer value). If the COM application was expecting the parameter to be a different type of numeric value, in most cases it will automatically convert it to the desired type. However, there are some COM applications which don't do this, and return an error instead.

In such cases, you can first specify the type using the function ObjectType. Or you can specify the type, using the following syntax:

 

Object.Method(p1, type:p2 :: name = value, type:name = value)

 

The parameter type (shown as 'type') is followed by a single colon (":"), and then the parameter itself. This can be done for both positional parameters and named parameters. Whitespace is ignored, and the type names are not case-sensitive.

Integer types which may be specified:

 

 

Variant Type

Meaning

NULL

This is like a pointer to NULL.

I1

1-byte signed integer.

I2

Two bytes representing a 2-byte signed integer value.

I4

4-byte signed integer value.

I8

8-byte signed integer value.

R4

32-bit IEEE floating point value.

R8

64-bit IEEE floating point value.

DECIMAL

A decimal value, specified as a string in the form "#DECIMAL:value".

UI1

1-byte unsigned integer.

UI2

2-byte unsigned integer.

UI4

4-byte unsigned integer.

UI8

8-byte unsigned integer.

CY

A currency value, specified as a string in the form "#CURRENCY:value".

DATE

A date/time value, specified as a string in Ymd or YmdHms format

BSTR

A string.

BOOL

A Boolean (True/False) value

ARRAY

If the type indicator is combined with ARRAY by an OR operator, the value is a pointer to a SAFEARRAY. ARRAY can use the OR with the following data types: I1, UI1, I2, UI2, I4, UI4, INT, UINT, R4, R8, BOOL, DECIMAL, ERROR, CY, DATE, and BSTR. ARRAY cannot use OR with VECTOR.

DISPATCH

A pointer to an object was specified. This object is known only to implement IDispatch.

 

Note: The default type for integer values is "I4" (VT_I4).

 

Note: There are some additional types that are supported, by using the BinaryOleType function. See the BinaryOleType function for details.

 

Here are some examples:

 

; this function requires a parameter of type VT_I2

objapp.CreateImageViewerObject(I2:1)

; this function requires a (named) parameter of type VT_DATE

objapp.CreateLog("access.log" :: DATE:startdate="97:11:01")

 

See Also:

WIL Type Viewer