Name
TVarData Type
Syntax
type
TVarData = packed record
VType: Word;
Reserved1, Reserved2, Reserved3: Word;
case Integer of
varSmallint: (VSmallint: Smallint);
varInteger: (VInteger: Integer);
varSingle: (VSingle: Single);
varDouble: (VDouble: Double);
varCurrency: (VCurrency: Currency);
varDate: (VDate: Double);
varOleStr: (VOleStr: PWideChar);
varDispatch: (VDispatch: Pointer);
varError: (VError: LongWord);
varBoolean: (VBoolean: WordBool);
varUnknown: (VUnknown: Pointer);
varByte: (VByte: Byte);
varString: (VString: Pointer);
varAny: (VAny: Pointer);
varArray: (VArray: PVarArray);
varByRef: (VPointer: Pointer);
end;Description
The TVarData record is Delphi’s
implementation of the Variant type. You can cast
any Variant to TVarData to
examine the internal workings of the Variant.
The VType field stores the variant type (as
returned by VarType). The other fields store
type-specific information. Values up to 8 bytes in size are stored
directly in the TVarData record. Larger items are
stored separately; the TVarData record holds a
pointer to the actual data (such as VArray, which
points to a TVarArray
record).
Tips and Tricks
VStringis actually a string type, but Delphi does not let you store a string in a variant record because it cannot initialize or finalize the record properly. Instead, the code that manages theVarianttakes care of initializing or finalizing the string.VUnknownis actually anIUnknowninterface, andVDispatchis anIDispatchinterface. As with strings, Delphi ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access