如何判断某个对象是否有某个属性(public级别的属性) GetPropInfo可以得到某个对象的Published出来的属性,但是无法判断Public级别的属性现在我想判断的是某个对象是否有某个属性,该属性却又是public级别的,请问要如何判断呢? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 属性必须定义在published段,才行,貌似public没有 GetPropInfo是根据类的RTTI指针和属性的名称字符串,返回属性的信息TPropInfo的指针 试试直接从vmt入手不知道行不行。 没有概念了,即使从VMT入手,当你要实现如SetPropinfo时,又该如何? VMT是可以解决的吧, 好像Delphi6 开发人员指南中有相关的代码, 楼主找找. procedure GetClassProperties(AClass: TClass; AStrings: TStrings);var PropCount, I: SmallInt; PropList: PPropList; PropStr: string;begin PropCount := GetTypeData(AClass.ClassInfo).PropCount; GetPropList(AClass.ClassInfo, PropList); for I := 0 to PropCount - 1 do begin case PropList[I]^.PropType^.Kind of tkClass : PropStr := '[Class]'; tkMethod : PropStr := '[Method]'; tkSet : PropStr := '[Set] '; tkEnumeration: PropStr := '[Enum] '; else PropStr := '[Field] '; end; PropStr := PropStr + PropList[I]^.Name; PropStr := PropStr + ': ' + PropList[I]^.PropType^.Name; AStrings.Add(PropStr); end; FreeMem(PropList);end; 不能一起使用多个模糊查询判断吗? 与上次题的而问题差不多!与dbgrid、查询相关 做记事本程序遇到的问题,请高手指点 高分求delphi 8.0的下载地址.不要试用版. 怎样阻截系统的SHIFT键? 数据库问题。急!(在线等候) 怎样获得文件的大小? 一个delphi编程的入门问题...小弟刚学,不懂,树上没有介绍... serversocket,clientsocket请看http://www.csdn.net/expert/Topic/123/123419.shtm 如何动态生成rtf文件 fastreport 4.0 预览问题? 初学delphi ,请问如何设置C\S 模式的连接
var
PropCount, I: SmallInt;
PropList: PPropList;
PropStr: string;
begin
PropCount := GetTypeData(AClass.ClassInfo).PropCount;
GetPropList(AClass.ClassInfo, PropList);
for I := 0 to PropCount - 1 do
begin
case PropList[I]^.PropType^.Kind of
tkClass : PropStr := '[Class]';
tkMethod : PropStr := '[Method]';
tkSet : PropStr := '[Set] ';
tkEnumeration: PropStr := '[Enum] ';
else
PropStr := '[Field] ';
end;
PropStr := PropStr + PropList[I]^.Name;
PropStr := PropStr + ': ' + PropList[I]^.PropType^.Name;
AStrings.Add(PropStr);
end;
FreeMem(PropList);
end;