Resources - colocando strings la

Top  Previous  Next

HOW TO ... create string resource files (*.res) ?

 

1Create a new textfile. 

 

content: 

 

STRINGTABLE 

BEGIN 

  1 , "first string" 

  2 , "second string" 

  3 , "Swiss Delphi Center" 

END 

 

2. When you have done this, save the file under test.rc 

3. Next you have to compile this resource script with the Borland resource compiler. 

 

  brc32.exe -r test.rc 

 

4. Now you have the compiled resource file test.res 

------------------------------------------------

HOW TO ...read values from string resource (*.res) ?

 

implementation 

 

{$R *.DFM} 

{$R test.res} //Your resource file 

 

procedure TForm1.Button1Click(Sender: TObject); 

var 

  puffer: array[0..255of char; 

begin 

  LoadString(hinstance,1,@puffer,255);  //1 = first string 

  label1.Caption:=strpas(puffer); 

end