在DELPHI中如何利用程序获取一个对象的所有信息。包括属性,方法!可以不包括继承下来的属性和方法!在DELHI每一个版本中都有一个对象浏览器,可以知道当前对象的所有信息,包括继承的层次关系!我记得在一个老的DELPHI版本中有过一个类似的代码,但现在手里已经没有那个盘了,望各位高手给予帮助!多谢了啊!
解决方案 »
- VirtualTree控件如何绘进度条?
- RichEdit 字体 问题
- 有什么能只显示年月的日期控件?
- 要求职了,请各们D友审审我的简历,我该对资方提什么条件.
- 为什么我的dbgrideh更新不了数据,请高手们帮忙看看啊!!!!
- 我用API函数CreateFile创建了一个文件,然后我怎么访问它?
- 一个异常古怪的问题??急,在线等待
- 有关于记录时间的一个问题,用sqlserver和delphi中的query部件,请各位多多指教。。。。
- FASTREPORT的问题,请大家指教了
- 高分求quickreportpro3.5 for D5 的下载地址
- 怎样将VB将的ActiveXDLL转化为Delphi的DLL
- AAFont 平滑特效字体控件包升级需求调查
TypInfo; procedure ListComponentProperties(Component: TComponent; Strings: TStrings);
var
Count, Size, I: Integer;
List: PPropList;
PropInfo: PPropInfo;
PropOrEvent, PropValue: string;
begin
Count := GetPropList(Component.ClassInfo, tkAny, nil);
Size := Count * SizeOf(Pointer);
GetMem(List, Size);
try
Count := GetPropList(Component.ClassInfo, tkAny, List);
for I := 0 to Count - 1 do
begin
PropInfo := List^[I];
if PropInfo^.PropType^.Kind in tkMethods then
PropOrEvent := 'Event'
else
PropOrEvent := 'Property';
PropValue := VarToStr(GetPropValue(Component, PropInfo^.Name));
Strings.Add(Format('[%s] %s: %s = %s', [PropOrEvent, PropInfo^.Name,
PropInfo^.PropType^.Name, PropValue]));
end;
finally
FreeMem(List);
end;
end; // Example: List all Properties/Events from Button1 in a TListBox procedure TForm1.Button1Click(Sender: TObject);
begin
ListComponentProperties(Button1, ListBox1.Items);
end;