使用FileCopy功能以Inno Setup Pascal代码安装文件(不以向导形式显示安装)
问题描述:
如何使用FileCopy
功能将文件复制到应用程序文件夹,以便其名称不显示在安装页面上? (FilenameLabel
).
How to copy a file using FileCopy
function to the application folder, so that it's name does not display on the installing page? (FilenameLabel
).
答
使用 CurStepChanged
事件函数中的c0>函数 a>:
Use the FileCopy
function in the CurStepChanged
event function:
[Files]
Source: "MyProg.exe"; Flags: dontcopy
[Code]
procedure CurStepChanged(CurStep: TSetupStep);
begin
{ Install after installation, as then the application folder exists already }
if CurStep = ssPostInstall then
begin
Log('Installing file');
ExtractTemporaryFile('MyProg.exe');
if FileCopy(
ExpandConstant('{tmp}\MyProg.exe'), ExpandConstant('{app}\MyProg.exe'),
False) then
begin
Log('File installed.');
end
else
begin
Log('Failed to install file.');
end;
end;
end;