Inno Setup刷新桌面 [英] Inno Setup refresh desktop

查看:95
本文介绍了Inno Setup刷新桌面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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

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

Either by using SendMessage or somehow use SHChangeNotify?

推荐答案

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

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;

现在,您可以在任意位置调用SendChangeNotification,例如在事件函数中.

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

更新

上面的文本回答了您的问题,即如何使用[Code]部分中的Inno Setup刷新桌面".但是您知道Inno Setup可以自动为您刷新桌面吗?只需写

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

ChangesAssociations=yes

[Setup]部分.

这篇关于Inno Setup刷新桌面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆