如何在Inno设置中检查64/32位

时间:2015-07-03 09:57:17

标签: inno-setup pascalscript

我想进入一个文件夹。如果为32位,则为Program Files (x86),如果为64位Program Files。如何在Inno设置中做到这一点。

这是我尝试的代码(但没有运气):

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
          if ProcessorArchitecture = paIA64 then
            begin
               if IsWin64 then
                DelTree(ExpandConstant('{userappdata}\Local\VirtualStore\Program Files (x86)\MY PROJECT'), True, True, True);
          else
                DelTree(ExpandConstant('{userappdata}\Local\VirtualStore\Program Files\MY PROJECT'), True, True, True);
          end;
      end;
  end;
end;

1 个答案:

答案 0 :(得分:2)

您的beginend&#39}不匹配。在else之前不应该有分号。

您不应该关心处理器架构(ProcessorArchitecture),而只关心Windows是否为64位(IsWin64)。

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
        begin
          if IsWin64 then
            DelTree(ExpandConstant('{userappdata}\Local\VirtualStore\Program Files (x86)\MY PROJECT'), True, True, True)
          else
            DelTree(ExpandConstant('{userappdata}\Local\VirtualStore\Program Files\MY PROJECT'), True, True, True);
        end;
      end;
  end;
end;
相关问题