So, und jetzt das ganze mal abändern, dann sollte es gehen:
Delphi-Quellcode:
var
VT: TVarType;
....
VT := VarType(lValue);
case VT
and varTypeMask
of
varStrArg: Writeln('
COM-compatible string');
varEmpty : Writeln('
The variant is Unassigned');
varOleStr : Writeln('
Reference to a dynamically allocated UNICODE string.');
varVariant : Writeln('
A variant');
varString : Writeln('
Reference to a dynamically allocated string (not COM compatible)');
varNull : WriteLn('
The variant is Null.');
varSmallint : WriteLn('
16-bit signed integer (type Smallint in Delphi, short in C++ ).');
varInteger : WriteLn('
32-bit signed integer (type Integer in Delphi, int in C++).');
varSingle : WriteLn('
Single-precision floating-point value (type Single in Delphi, float in C++).');
varDouble : WriteLn('
Double-precision floating-point value (type double).');
varCurrency : WriteLn('
Currency floating-point value (type Currency).');
varDate : WriteLn('
Date and time value (type TDateTime).');
varDispatch : WriteLn('
Reference to an Automation object (an IDispatch interface pointer).');
varError : WriteLn('
Operating system error code.');
varBoolean : WriteLn('
16-bit boolean (type WordBool).');
varUnknown : WriteLn('
Reference to an unknown object (an IInterface or IUnknown interface pointer).');
varShortInt : WriteLn('
8-bit signed integer (type ShortInt in Delphi or signed char in C++)');
varByte : WriteLn('
A Byte');
varWord : WriteLn('
unsigned 16-bit value (Word)');
varLongWord : WriteLn('
unsigned 32-bit value (type LongWord in Delphi or unsigned long in C++)');
varInt64 : WriteLn('
64-bit signed integer (Int64 in Delphi or __int64 in C++)');
varAny : WriteLn('
A CORBA Any value.');
else
WriteLn('
Kein Typ erkannt!');
end;
if VT
and varArray
then
WriteLn('
als Array');
if VT
and varByRef
then
WriteLn('
als Referenz (Pointer)');
...
...