刷新shell在Inno设置中的关联(仅在检查函数时)
Refresh shell associations in Inno Setup conditionally (only if a function is checked)
正如标题所说,我怎样才能让 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;
我需要当我简单地提取我的软件的便携版本时,关联不会被调用。
不使用 ChangesAssociations
指令,调用 SHChangeNotify
WinAPI function conditionally from CurStepChanged(ssPostInstall)
:
[Code]
const
SHCNE_ASSOCCHANGED = 000000;
SHCNF_IDLIST = [=10=]000000;
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
内部所做的。
部分基于:Inno Setup refresh desktop.
顺便说一下,下个版本你可以这样写:
[Setup]
ChangesAssociations=installation
[Code]
function installation: Boolean;
begin
Result := install.Checked; { only if this is checked }
end;
谢谢你的想法:)
正如标题所说,我怎样才能让 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;
我需要当我简单地提取我的软件的便携版本时,关联不会被调用。
不使用 ChangesAssociations
指令,调用 SHChangeNotify
WinAPI function conditionally from CurStepChanged(ssPostInstall)
:
[Code]
const
SHCNE_ASSOCCHANGED = 000000;
SHCNF_IDLIST = [=10=]000000;
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
内部所做的。
部分基于:Inno Setup refresh desktop.
顺便说一下,下个版本你可以这样写:
[Setup]
ChangesAssociations=installation
[Code]
function installation: Boolean;
begin
Result := install.Checked; { only if this is checked }
end;
谢谢你的想法:)