无法删除使用Inno Setup在“我的文档”中创建的文件夹

时间:2011-01-28 14:07:39

标签: inno-setup uninstall

我尝试使用此处描述的程序Problems in deleting a Folder during the uninstalation with Inno Setup

在发布答案之后但由于某些未知原因我的代码部分没有做任何事情。可能与Windows版本有关,或者它是32位还是64位?

以下是我使用的代码:

procedure CurUninstallStepChanged (CurUninstallStep: TUninstallStep);
var
mres : integer;
begin
 case CurUninstallStep of
 usPostUninstall:
 begin
mres := MsgBox('Do you want to delete saved games?', mbConfirmation, MB_YESNO or MB_DEFBUTTON2)
 if mres = IDYES then
   DelTree('ExpandConstant({userdocs}\SpellForce2)', True, True, True);
    end;  
  end;
end;

任何可能对我有用的想法?

提前致谢! :)

2 个答案:

答案 0 :(得分:1)

你做不到

DelTree('ExpandConstant({userdocs}\SpellForce2)', True, True, True);

当然,这应该是

DelTree(ExpandConstant('{userdocs}\SpellForce2'), True, True, True);

答案 1 :(得分:1)

您正在尝试删除名为'ExpandConstant({userdocs} \ SpellForce2)'(字面意思)的文件夹,只需将'字符移除到ExpandConstant调用(它是一个子调用例程)。

procedure CurUninstallStepChanged (CurUninstallStep: TUninstallStep);
var
  mres : integer;
begin
  case CurUninstallStep of
    usPostUninstall:
      begin
        mres := MsgBox('Do you want to delete saved games?', mbConfirmation, MB_YESNO or MB_DEFBUTTON2)
        if mres = IDYES then
          DelTree(ExpandConstant('{userdocs}\SpellForce2'), True, True, True);
      end;  
  end;
end;
相关问题