I use a list of words in my Delphi program, and until now I would place the list in the Lines property of a TMemo. I don't need the visual component, though, rather a TStringList, so now I want to do things the proper way by using a resource file for this, and load my TStringList from the resource. I tried applying the information from this answer, but I get an error:
[dcc32 Error] E2161 Error: RLINK32: Unsupported 16bit resource in file "D:\etc\Unit1.rc"
For good measure, I have this Unit1.rc file:
RC_keywords RCDATA "keywords.txt"
I created this in Project → Resources and images..., but it looks like this is the same as writing the .rc file yourself.
In my program I have this resource include:
{$R *.rc}
and in my procedure
procedure TForm1.FormCreate(Sender: TObject);
var
SL: TStringList;
ResStream: TResourceStream;
begin
SL := TStringList.Create;
try
ResStream := TResourceStream.Create(hInstance, 'RC_keywords', RT_RCDATA);
SL.LoadFromStream(ResStream);
//
// do a lot of useful stuff here
//
finally
SL.Free;
end;
What's wrong here?