如何从delphi 7中的资源文件读取? [英] How to read from Resource file in delphi 7?
本文介绍了如何从delphi 7中的资源文件读取?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已经制作了资源文件,并已将其编译并链接到我的delphi单元。但是从该资源文件读取数据时我遇到了问题。
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;
我已经尝试了上面的代码,但显示未找到资源ExeTest
I have tried above code but it shows Resource ExeTest not found
推荐答案
如果要导出RCDATA,则rc文件必须如下所示:
If you want to export RCDATA, your rc file has to look like this:
ExeTest RCDATA YourDataFileName
这篇关于如何从delphi 7中的资源文件读取?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文