IVariantChangeType::ChangeType

Takes a variant value and creates a new variant with a specified type.

Syntax

HRESULT ChangeType(  
   VARIANT*  pvarDst,  
   VARIANT*  pvarSrc,  
   LCID  lcid,  
   VARTYPE  vtNew  
);  

Parameters

pvarDst
[in, out] A variant to contain the value represented by pvarSrc, but with the type specified by vtNew.

pvarSrc
[in] A variant value to change into a new type.

lcid
[in] The locale context to use when converting the arguments to or from strings.

vtNew
[in] Specifies the type for pvarDst to become.

Return Value

The method returns an HRESULT. Possible values include, but are not limited to, those in the following table.

Value Description
S_OK The method succeeded.

Remarks

The pvarDst and pvarSrc arguments may be equal, in which case the original value is overwritten. This method passes pvarDst to the VariantClear function, and consequently pvarDst should be initialized to a valid value.

See also

IVariantChangeType Interface