How to read from Resource file in delphi 7?

和自甴很熟 提交于 2019-12-20 05:10:32

问题


I have made resource file and have compiled and linked it with my delphi unit.But I am facing problems when reading from that resource file.

implementation

{$R *.dfm}
{$R 'stuff.res' 'stuff.rc'}

procedure TForm1.FormCreate(Sender: TObject);
  var vExeFile: string;
  RS: TResourceStream;
begin
  RS := TResourceStream.Create(HInstance, 'ExeTest', RT_RCDATA);
  try
    vExeFile := ExtractFilePath(ParamStr(0)) + 'tmp.exe';
    RS.SaveToFile(vExeFile);
  finally
    RS.Free;
 end;
end;

I have tried above code but it shows Resource ExeTest not found


回答1:


If you want to export RCDATA, your rc file has to look like this:

ExeTest RCDATA YourDataFileName


来源:https://stackoverflow.com/questions/14021066/how-to-read-from-resource-file-in-delphi-7

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!