Share via


COMVariant::createFromInt Method

Creates a new COMVariant object and initializes it with an integer value in one operation.

Syntax

client server public static COMVariant createFromInt(int value, [COMVariantInOut inOutFlag])

Run On

Called

Parameters

  • value
    Type: int
    The integer value that is used to initialize the object.
  • inOutFlag
    Type: COMVariantInOut Enumeration
    A flag that determines whether the object can be used to pass data to a COM method or COM property, to receive data, or both. This parameter is optional.
    Possible values are:

Return Value

Type: COMVariant Class
The new COMVariant object.

Remarks

The COMVariant object that is created by this method has the data type VT_I4 (integer).

You can change the data type of an existing COMVariant object to VT_I4 by using the variantType method or by passing in an integer value by using the int property method.

Examples

The following example creates a COMVariant object of the VT_I4 variant data type (integer), and sets the value to 123.

{ 
    COMVariant var; 
  
    var = COMVariant::createFromInt(123); 
}

See Also

COMVariant Class

COMVariant.int Method

COMVariant.new Method

COMVariant.variantType Method