【问题标题】:Inno Setup: Delete folder with Task functionInno Setup:使用任务功能删除文件夹
【发布时间】:2014-08-18 16:53:05
【问题描述】:

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

非常感谢。

【问题讨论】:

  • [InstallDelete] 是第一个处理的部分。当他们单击“下一步”或仅在安装的第一阶段是否真的需要删除它?在设置开始之前进行任何更改通常是一个坏主意。

标签: inno-setup


【解决方案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;

【讨论】:

  • 我稍后会尝试并告诉你。
  • 我刚试过,效果很好!再次感谢您的帮助。
  • 插入代码时的疑问:如果我在 DelTree 中放置了整个路径(例如:C:\test*),它可以正常工作。但是如果我把(DelTree('{app}\test*'),它不起作用。我知道我必须注册路径的字符串但我不知道如何,或者我认为这就是问题所在。任何想法?
  • 你忘了ExpandConstantDelTree(ExpandConstant('{app}\test*')) 应该更好;-)
  • 没有你我真不知道该怎么办;)谢谢
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2012-12-29
  • 1970-01-01
  • 1970-01-01
  • 2015-02-22
  • 2011-06-17
  • 2020-09-09
相关资源
最近更新 更多