我正在使用Inno安装程序,并且想在卸载过程中删除安装程序未创建的AppData\Local\MyApp,但我想给用户一个选项来删除此数据而没有消息框。
这是我要实现的屏幕截图示例。
这是我已经看到的一些示例。
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?
我希望能够添加一个可选复选框,以便如果用户卸载程序,则可以删除此隐藏数据..但是,如果用户只是升级或计划以后安装,则可以保留此字段为未选中状态,而不能删除此生成的数据。
我肯定错过了一些非常简单的东西,但是我暂时无法解决。
谢谢。
最佳答案
这是在卸载过程中创建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'
。