Inno Setup可选卸载期间删除appdata \ YourApp?

时间:2015-03-17 21:09:58

标签: inno-setup uninstaller

我正在使用Inno安装程序,我想在卸载期间删除安装程序未创建的AppData \ Local \ MyApp,但我想让用户选择在没有消息框的情况下删除此数据。

以下是我想要实现的屏幕截图示例。

enter image description here

以下是我已经看过的一些例子。

How to clear user's app data folders with Inno Setup?

Can't delete the folder created in My Documents with Inno Setup

http://www.jrsoftware.org/ishelp/index.php?topic=uninstalldeletesection

http://www.codeproject.com/Questions/243529/Inno-Setup-ask-user-on-uninstall-if-they-want-to-k

How can my installer optionally delete some files it didn't initially create?

我希望能够添加一个可选复选框,因此如果用户卸载该程序,他们可以删除此隐藏数据..但如果用户只是升级或计划稍后安装,他们可以取消选中此字段而不删除这个生成的数据。

我必须遗漏一些非常简单的东西,但我现在无法解决这个问题。

感谢。

1 个答案:

答案 0 :(得分:2)

以下是在卸载期间创建msg框的示例 -

`[Code]
 procedure CurUninstallStepChanged (CurUninstallStep: TUninstallStep);
 var
     mres : integer;
 begin
    case CurUninstallStep of                   
      usPostUninstall:
        begin
          mres := MsgBox('Do you want to Remove settings?', mbConfirmation, MB_YESNO or MB_DEFBUTTON2)
          if mres = IDYES then
            DelTree(ExpandConstant('{userappdata}\Myapp'), True, True, True);
       end;
   end;
end;  `

您可以根据需要更改'{userappdata}\Myapp'

相关问题