问题
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}\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:
Your begin's and end's do not match. And there should be no semicolon before else.
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}\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;
来源:https://stackoverflow.com/questions/31203891/how-to-check-64-32-bit-in-inno-setup