procedure LoadInterface(TypeInfo: ITypeInfo; TypeAttr: PTypeAttr; List:
TStrings);
var
AName: WideString;
ADocString: WideString;
AHelpContext: LongInt;
FuncDesc: PFuncDesc;
i, j: Integer;
Names: PBStrList;
cNames: Integer;
strItem: string;
begin
TypeInfo.GetDocumentation(-1, @AName, @ADocString, @AHelpContext, nil);
New(Names);
try
// load functions
for i := 0 to TypeAttr.cFuncs - 1 do
begin
TypeInfo.GetFuncDesc(i, FuncDesc);
try
TypeInfo.GetDocumentation(FuncDesc.memid, @AName, @ADocString,
@AHelpContext, nil);
strItem := AName;
if FuncDesc.cParams > 0 then
begin
// load parameters
TypeInfo.GetNames(FuncDesc.memid, Names, SizeOf(TBStrList),
cNames);
strItem := strItem + '(';
// Skip Names[0] - it's the function name
for j := 1 to FuncDesc.cParams do
if j < 2 then
strItem := strItem + Names[j]
else
strItem := strItem + ', ' + Names[j];
strItem := strItem + ')';
end;
if (ADocString <> '') then
strItem := strItem + #9 + ADocString;
list.Add(strItem);
finally
TypeInfo.ReleaseFuncDesc(FuncDesc);
end;
end;
finally
Dispose(Names);
end;
end;