Mega Code Archive

 
Categories / Delphi / Examples
 

Resourcestring replaces loadstr[]

Delphi 3 introduced the possiblity to easily place constant strings as a resource with the new keyword 'resourcestring'. If you want to write code that compiles both with Delphi 2 and 3 because you are publishing a component, take a look at this sample code: // this is code for Delphi 1/ 2. // It uses LoadStr to access resource strings raise SomeException.Create(LoadStr(SInsertLineError)); // this uses VER100 to detect if Delphi 3.x is used. raise SomeException.Create( {$IFNDEF VER100}LoadStr{$ENDIF} (SInsertLineError)); // from Stefan Hoffmeister