Product Documentation

VCL/CLX Developers Guide

Previous Topic

Next Topic

Getting and setting resource properties

A number of properties are provided to enable the getting and, in most cases, the setting of resource object properties. The table below describes each property:

Property

Type

Description

TypeID

LongWord

Get or set the resource type.

Number

LongWord

Get or set the resource number.

Resource

String

Get or set the resource name.

Locked

Boolean

Indicate if resource is locked. Read-only.

DataLength

Integer

Get the number of bytes in resource data. Read-only.

Data

Pointer

Get a pointer to the resource data. Read-only.

The example below show how to use the TCtResource properties.

Example


procedure ShowProperties(hTable : TCtTable);

var

hRes : TCTResource;


begin

Writeln('Resource properties of MyResource');

hRes := TCtResource.Create(hTable, 0, 0);

try

// find a resource

if hRes.Find('MyResource', true) then

begin

Writeln('TypeID : ', hRes.TypeID);

Writeln('Number : ', hRes.Number);

Writeln('Resource : ', hRes.Resource);

Writeln('Locked : ', hRes.Locked);

Writeln('DataLength: ', hRes.DataLength);

Writeln('Data : ', string(PChar(hRes.Data)));

// set the properties just for testing

hRes.TypeID := 0;

hRes.Number := 0;

hRes.Resource := 'Another name';

end;

except

on err: ECtError do Writeln('Error ', err.Message);

end;

hRes.Free;

end;


TOCIndex