- procedure TForm1.BuildRes(ResPrgName:string;ResTyp:string;PrgName:String);
- var
- Res : TResourceStream;
- WinDir:string;
- begin
- try
- WinDir:=ExtractFilePath(ParamStr(0)); {ParamStr为系统参数,0表示当前程序的名称}
- ShowMessage(ParamStr(0));
- if RightStr(WinDir,1) <> '\' then
- WinDir := WinDir '\';
- Res := TResourceStream.Create(Hinstance, ResPrgName, Pchar(ResTyp));
- Res.SavetoFile(Windir PrgName);
- finally
- Res.Free;
- end;
- end;
下面是资源文件Res.rc
- pborc60 dll pborc60.dll
- sn txt sn.txt
- pbodb90 RCDATA pbodb90.dll
调用下面方法就可以将资源中的资源导出来
BuildRes ('SN','TXT','SN1.txt');
BuildRes ('PBORC60','DLL','pborc601.dll');
未解决的问题
RCDATA类型的总是导不出来,不知道是什么原因
以上代码均在Delphi7中测试通过,示例代码下载:
阅读(765) | 评论(0) | 转发(0) |