{$R resource.res}
function LoadTextFromResourceByName(ResourceName: ansiString): AnsiString;
var
ResourceStream: TResourceStream;
begin
ResourceStream := TResourceStream.Create(HInstance, ResourceName, RT_RCDATA);
try
try
SetLength(Result, ResourceStream.Size);
ResourceStream.ReadBuffer(Result[1], ResourceStream.Size);
except
raise;
end;
finally
ResourceStream.Free;
end;
end;
function LoadTextFromResourceByID(ResourceID: Cardinal): AnsiString;
var
ResourceStream: TResourceStream;
begin
ResourceStream := TResourceStream.CreateFromID(HInstance, ResourceID, RT_RCDATA);
try
try
SetLength(Result, ResourceStream.Size);
ResourceStream.ReadBuffer(Result[1], ResourceStream.Size);
except
raise;
end;
finally
ResourceStream.Free;
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
try
//Memo1.Text := LoadTextFromResourceByID(100);
Memo1.Text := LoadTextFromResourceByName('
ExcludeList');
except
on E:
Exception do
ShowMessage(E.
Message);
end;
end;