1

当我使用 Inno Setup 卸载程序卸载我的应用程序时,在用户的 AppData 文件夹中创建的运行时文件仍然存在。是否可以删除它们?

4

1 回答 1

2

您可以创建一个 CurUninstallStepChanged 例程来执行您想要的任何自定义操作,例如在卸载期间删除系统上的文件。

看看这个例子(来自这个问题):

procedure CurUninstallStepChanged (CurUninstallStep: TUninstallStep);
var
  mres : integer;
begin
  case CurUninstallStep of
    usPostUninstall:
      begin
        mres := MsgBox('Do you want to delete saved files?', mbConfirmation, MB_YESNO or MB_DEFBUTTON2)
        if mres = IDYES then
          DelTree(ExpandConstant('{userdocs}\MyApp'), True, True, True);
      end;  
  end;
end;
于 2011-01-28T15:52:47.230 回答