RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
VarUtils.VariantChangeType Function

Converts a variant from one type to another.

Pascal
function VariantChangeType(var Dest: TVarData; const Source: TVarData; wFlags: Word; VarType: Word): HRESULT; stdcall;
C++
__stdcall HRESULT VariantChangeType(TVarData Dest, const TVarData Source, Word wFlags, Word VarType);

Use VariantChangeType to convert the variant given in Source to the variant stored in Dest of type VarType, using the parameter wFlags, which specifies the conversion flags.  

VariantChangeType returns the result of the conversion operation, which can be one of the following.

Value 
Meaning 
The conversion was successful. 
The variant type of the input parameter is not valid. 
The data stored in the output parameter does not fit in the destination type. 
The argument cannot be cast to the specified type. 
Either one of the arguments is invalid. 
There is not enough memory to complete the conversion. 

Note: To do the conversion using locale-specific information, use the function referenced by the VariantChangeTypeEx variable.
 

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!