Inno安装程序刷新桌面

时间:2011-05-01 15:23:17

标签: windows inno-setup pascalscript

是否可以使用[Code]部分中的Inno Setup刷新桌面?

使用SendMessage还是以某种方式使用SHChangeNotify

1 个答案:

答案 0 :(得分:3)

您可以通过在相应的DLL中调用它来调用Windows API中的任何函数。 Pascal DLL语法记录为here。有SHChangeNotify函数的文档可以像往常一样在MSDN中找到。此功能可在Shell32.dll中找到(毫不奇怪!)。

[Code]
const
  SHCNE_ASSOCCHANGED = $08000000;
  SHCNF_IDLIST = $00000000;

procedure SHChangeNotify(wEventID: integer; uFlags: cardinal; dwItem1, dwItem2: cardinal);
external 'SHChangeNotify@shell32.dll stdcall';

procedure SendChangeNotification;
begin
  SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST, 0, 0);
end;

现在,您可以随时随地拨打SendChangeNotification,例如event function

<强>更新

上面的文字回答了您的问题,如何“在[代码]部分使用Inno Setup刷新桌面”。但是你知道Inno Setup可以自动为你刷新桌面吗?只需写下

ChangesAssociations=yes
<{1>}部分中的