正如标题所述,如何使Inno Setup使用:
[Setup]
ChangesAssociations=yes
仅在检查某些功能时:
function installation: Boolean;
begin
Result := install.Checked; { only if this is checked }
end;
function portable: Boolean;
begin
Result := porta.Checked;
end;
我只需要提取软件的可移植版本就不需要调用该关联。
答案 0 :(得分:2)
Fyi,在下一版本中,您将能够编写:
[Setup]
ChangesAssociations=installation
[Code]
function installation: Boolean;
begin
Result := install.Checked; { only if this is checked }
end;
感谢这个想法:)
答案 1 :(得分:1)
不是使用ChangesAssociations
指令,而是有条件地从SHChangeNotify
WinAPI function调用CurStepChanged(ssPostInstall)
:
[Code]
const
SHCNE_ASSOCCHANGED = $08000000;
SHCNF_IDLIST = $00000000;
procedure SHChangeNotify(wEventID: Integer; uFlags: Cardinal; dwItem1, dwItem2: Cardinal);
external 'SHChangeNotify@shell32.dll stdcall';
procedure CurStepChanged(CurStep: TSetupStep);
begin
if CurStep = ssPostInstall then
begin
if installation then
begin
SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST, 0, 0);
end;
end;
end;
ChangesAssociations=yes
内部就是这样。