开发者

Inno Setup refresh desktop

开发者 https://www.devze.com 2023-03-01 17:09 出处:网络
Is it possible to refresh the desktop using Inno Setup in the [Code] section? Either by using Se开发者_如何学CndMessage or somehow use SHChangeNotify?You can call any function in the Windows API by c

Is it possible to refresh the desktop using Inno Setup in the [Code] section?

Either by using Se开发者_如何学CndMessage or somehow use SHChangeNotify?


You can call any function in the Windows API by calling it in the appropriate DLL. The Pascal DLL syntax is documented here. The documentation of the SHChangeNotify function is found at MSDN as usual. This function is found in Shell32.dll (no surprise!).

[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;

Now you can call SendChangeNotification anywhere you like, for instance in an event function.

Update

The text above answers your question, how to "refresh the desktop using Inno Setup in the [Code] section". But did you know that Inno Setup can refresh the desktop for you, automatically? Simply write

ChangesAssociations=yes

in the [Setup] section. See: ChangesAssociations

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号