如对一个变量,假设看不到其定义部分,如何知道它的类型
解决方案 »
- DbGridEH为什么插入新行会全选所有记录。悲剧!
- invalid index??
- delphi2005里面如何加入非官方控件?
- 找一个控件,显示树的数据结构,每个节点能有checkbox选择这个节点
- 在Delphi中如何建立和编写触发器、存储过程,要用什么工具建立,建立以后代码存放在哪里?
- ★★★★★★★★急!急!有点难度的问题:如何获得DBGridEh网格中正在编辑的字段值★★★★★★★★
- 急急:win98下编译的系统在WIN2000 SERVER下为什么不能运行??
- 高手可以不看
- 怎么没人回答!!!如何从数码相机中取出图片?
- 百分全送,再送百分,请问个位高手,怎么看待VB和DELPHI,优势分别是什么啊! 还有IT认证, 国家,和公司的那个更具优势
- 语句错误!急用
- Image报错,急切
varNull The variant is Null.
varSmallint 16-bit signed integer (type Smallint in Delphi, short in C++ ).
varInteger 32-bit signed integer (type Integer in Delphi, int in C++).
varSingle Single-precision floating-point value (type Single in Delphi, float in C++).
varDouble Double-precision floating-point value (type double).
varCurrency Currency floating-point value (type Currency).
varDate Date and time value (type TDateTime).varOleStr Reference to a dynamically allocated UNICODE string.
varDispatch Reference to an Automation object (an IDispatch interface pointer).
varError Operating system error code.
varBoolean 16-bit boolean (type WordBool).
varVariant A variant.
varUnknown Reference to an unknown object (an IInterface or IUnknown interface pointer).
varShortInt 8-bit signed integer (type ShortInt in Delphi or signed char in C++)
varByte A Byte
varWord unsigned 16-bit value (Word)varLongWord unsigned 32-bit value (type LongWord in Delphi or unsigned long in C++)
varInt64 64-bit signed integer (Int64 in Delphi or __int64 in C++)
varStrArg COM-compatible string.
varString Reference to a dynamically allocated string (not COM compatible).
varAny A CORBA Any value.The value returned by VarType corresponds to the VType field of a TVarData record.The type of a variant can be changed using VarAsType.
function VarType(const V: Variant): TVarType;
begin
Result := TVarData(V).VType;
end;
TVarData = packed record
case Integer of
0: (VType: TVarType;
case Integer of
0: (Reserved1: Word;
case Integer of
0: (Reserved2, Reserved3: Word;
case Integer of
varSmallInt: (VSmallInt: SmallInt);
varInteger: (VInteger: Integer);
varSingle: (VSingle: Single);
varDouble: (VDouble: Double);
varCurrency: (VCurrency: Currency);
varDate: (VDate: TDateTime);
varOleStr: (VOleStr: PWideChar);
varDispatch: (VDispatch: Pointer);
varError: (VError: HRESULT);
varBoolean: (VBoolean: WordBool);
varUnknown: (VUnknown: Pointer);
varShortInt: (VShortInt: ShortInt);
varByte: (VByte: Byte);
varWord: (VWord: Word);
varLongWord: (VLongWord: LongWord);
varInt64: (VInt64: Int64);
varString: (VString: Pointer);
varAny: (VAny: Pointer);
varArray: (VArray: PVarArray);
varByRef: (VPointer: Pointer);
);
1: (VLongs: array[0..2] of LongInt);
);
2: (VWords: array [0..6] of Word);
3: (VBytes: array [0..13] of Byte);
);
1: (RawData: array [0..3] of LongInt);
end;
s:word; //定义不同的类型...
begin
ShowMessage(IntToStr(VarType(s)));
end;显示出不同的数字,譬如string是256....有趣...
现在的问题是:如何能枚举出一个类的所有属性和方法?