delphi - How can my program read a string from a RES file? -


i have .rc file included in project , compiles res file. want access value associated "companyname". there way reference it? instance like

string st = versioninfo["companyname"] 

or totally misunderstanding it?

and suppose followup, proper format string table?

to load string program's string-table resources, use delphi's loadstr function. pass numeric id of string wish read. it's wrapper windows loadstring api function.

delphi supports resourcestrings natively. instead of declaring const, use resourcestring, , string automatically included in compiler-generated string table. can refer string named identifier in code, , run-time library handle details of loading program's resources. don't have call loadstr or else. declare bunch of resourcestrings in build-generated file it's date. example:

// auto-generated; not edit unit resources; interface resourcestring   companyname = '***'; implementation end. 

if want manage string tables yourself, refer the msdn documentation. example:

#define ids_companyname 1  stringtable begin   ids_companyname, "***" end 

to read in program:

const   ids_companyname = 1;  var   companyname: string;  companyname := loadstr(ids_companyname); 

Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -