I'm trying to iterate through a COM object class to list all the properties, but readonly properties are not coming through. The class is defined with many properties but here are a couple ...
property RecLineSpacing: Integer dispid 123;
property RecLinesToPaperCut: Integer readonly dispid 124;
The code I'm iterating with is ...
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;
In this case the output lists RecLineSpacing but not RecLinesToPaperCut. Any idea why this would be?
Thanks Terry