Inno Setup:使用Task功能删除文件夹

时间:2014-08-18 16:53:05

标签: inno-setup

如何使用在“附加任务”面板中点击“下一步”按钮时必须执行的任务功能删除文件夹?

非常感谢先进。

1 个答案:

答案 0 :(得分:1)

要检查是否选择了某项任务,您可以使用IsTaskSelected功能。因此,为了满足您的要求,您可以写下这样的内容:

[Setup]
AppName=My Program
AppVersion=1.5
DefaultDirName={pf}\My Program

[Tasks]
Name: deletefolder; Description: "Delete a folder"; GroupDescription: "Group Description:"

[Code]
function NextButtonClick(CurPageID: Integer): Boolean;
begin
  // allow the setup turning to the next page
  Result := True;
  // if we are on the Additional Tasks page and the task is selected, then...
  if (CurPageID = wpSelectTasks) and IsTaskSelected('deletefolder') then
    // here call the RemoveDir or DelTree function depending on your needs
end;