繁体   English   中英

如何在 Inno Setup 中检查 64/32 位

[英]How to check 64/32-bit in Inno Setup

我想进入一个文件夹。 如果是 64 位Program Files如果是 32 位,它将是Program Files (x86) 如何在 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;

您的beginend不匹配。 并且在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;

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM