Before any operations can be performed on resources, you are required to instantiate a resource object. There are three overloaded TCtResource constructors:
constructor TCtResource.Create(hTable : TObject);
Construct a CTResource object with the resource type and number set to zero and the resource name set to NULL.
constructor TCtResource.Create(hTable : TObject; TypeID : LongWord; number : LongWord);
Construct a CTResource object passing the resource type and number. The resource name is set to NULL.
constructor TCtResource.Create(hTable : TObject; TypeID : LongWord; number : LongWord; name : string);
Construct a CTResource object passing the resource type and number, as well as the resource name.
Example
procedure DisplayAllResources(hTable : TCtTable);
var
hRes : TCTResource;
begin
Writeln('Displaying all resources of table ', hTable.Table);
hRes := TCtResource.Create(hTable, 1, 2, 'test');
try
// get the first resource
if hRes.First(false) then
begin
repeat
// display resource type, number and name
Writeln('Resource type: ', hRes.TypeID,
', number: ', hRes.Number,
', name: ', hRes.Resource);
until not hRes.Next(false);
end;
except
on err: ECtError do Writeln('Error ', err.Message);
end;
hRes.Free;
end;