如何在 Inno Setup 中检查 64/32 位 [英] How to check 64/32-bit in Inno Setup

查看:33
本文介绍了如何在 Inno Setup 中检查 64/32 位的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想进入一个文件夹.如果是 64 位 Program Files 如果是 32 位,它将是 Program Files (x86).如何在 Inno setup 中做到这一点.

I want to go inside a folder. It will be Program Files (x86) if 64-bit Program Files if 32-bit. How to do that in Inno setup.

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

This is the code I tried (but no luck):

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}LocalVirtualStoreProgram Files (x86)MY PROJECT'), True, True, True);
          else
                DelTree(ExpandConstant('{userappdata}LocalVirtualStoreProgram FilesMY PROJECT'), True, True, True);
          end;
      end;
  end;
end;

推荐答案

您的 beginend 不匹配.并且else前不能有分号.

Your begin's and end's do not match. And there should be no semicolon before else.

你不应该关心处理器架构(ProcessorArchitecture),但仅限于 Windows 是否为 64 位(IsWin64).

And you should not care about processor architecture (ProcessorArchitecture), but only whether the Windows is 64-bit (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}LocalVirtualStoreProgram Files (x86)MY PROJECT'), True, True, True)
          else
            DelTree(ExpandConstant('{userappdata}LocalVirtualStoreProgram FilesMY PROJECT'), True, True, True);
        end;
      end;
  end;
end;

这篇关于如何在 Inno Setup 中检查 64/32 位的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆