我正在尝试遍历COM对象类以列出所有属性,但是readonly属性没有通过。该类定义了许多属性,但这里有一对...
property RecLineSpacing: Integer dispid 123;
property RecLinesToPaperCut: Integer readonly dispid 124;
我正在迭代的代码是......
function PropertyValues(const AObject: TObject) : TStringlist;
var
PropIndex: Integer;
PropCount: Integer;
PropList: PPropList;
PropInfo: PPropInfo;
const
TypeKinds: TTypeKinds = [tkUnknown, tkInteger, tkChar, tkEnumeration, tkFloat,
tkString, tkSet, tkClass, tkMethod, tkWChar, tkLString, tkWString,
tkVariant, tkArray, tkRecord, tkInterface, tkInt64, tkDynArray, tkUString,
tkClassRef, tkPointer, tkProcedure];
begin
result:=tstringlist.Create;
GetMem(PropList, SizeOf(PropList^));
try
PropCount := GetPropList(AObject.ClassInfo, TypeKinds, PropList);
for PropIndex := 0 to PropCount - 1 do
begin
PropInfo := PropList^[PropIndex];
result.Add ('['+propinfo.Name+']');
end;
finally
FreeMem(PropList);
end;
end;
在这种情况下,输出列出RecLineSpacing但不列出RecLinesToPaperCut。知道为什么会这样吗?
由于 特里