Share via


COMVariant.iDispatch Method

Gets or sets the value of a COMVariant object of the VT_DISPATCH data type.

Syntax

public ComInterface iDispatch([ComInterface newValue])

Run On

Called

Parameters

Return Value

Type: ComInterface Extended Data Type
The current value.

Remarks

If you pass in a value that has a different data type than the object, the data type of the object will be changed to match the data type of the value.

A COMVariant object has an IDispatch data type if its data type is set to COMVariantType::VT_DISPATCH.

The IDispatch data type is a COM data type that provides a handle to a COM IDispatch interface.

Examples

The following example creates a new COMVariant object of type VT_DISPATCH.

{ 
    COMVariant var = new COMVariant( 
        COMVariantInOut::IN_OUT,  
        COMVariantType::VT_DISPATCH); 
    COMInterface comInterface; 
  
    // Here, the comInterface variable must be assigned 
    // a COM IDispatch interface 
    //… 
 
    // Set value of the object 
    var.iDispatch(comInterface); 
}

See Also

COMVariant Class

COMVariantType Enumeration

COMVariant.new Method

COMVariant.variantType Method