Inno setup 在Inno设置中,如何模拟在系统托盘上移动鼠标?

Inno setup 在Inno设置中,如何模拟在系统托盘上移动鼠标?,inno-setup,system-tray,Inno Setup,System Tray,我需要一个图标从系统托盘中消失。当我把鼠标移到它上面时,它确实消失了。我可以使用Inno设置来模拟鼠标移动吗?我在网上找到了一些Pascal代码,但无法在Inno中运行。也许我错过了一些简单的事情 uses .... probably not all of these are necessary, but jwawinuser is at least.... JwaTlHelp32 {for running processes}, JwaWinType {for processes d

我需要一个图标从系统托盘中消失。当我把鼠标移到它上面时,它确实消失了。我可以使用Inno设置来模拟鼠标移动吗?我在网上找到了一些Pascal代码,但无法在Inno中运行。也许我错过了一些简单的事情

uses 
.... probably not all of these are necessary, but jwawinuser is at least....
  JwaTlHelp32 {for running processes},
  JwaWinType {for processes declarations},
  JwaWinBase {just a guess: for closing process handles},
  JwaWinSvc {for services declarations, always required},
  jwawinuser {for clearing tray icon/notification area},
....
procedure CleanSystemTray;
  {description Clean dead icons from system tray/notification area}
var
  hNotificationArea: HWND;
  r: RECT;
  x: integer;
  y: integer;
begin
  hNotificationArea:=FindWindowEx(
    FindWindowEx(FindWindowEx(FindWindowEx
    (0,0,'Shell_TrayWnd', ''),0,'TrayNotifyWnd', ''),0,'SysPager',''),
    0,
    'ToolbarWindow32',
    'Notification Area');
  GetClientRect(hNotificationArea,r);

  //Now we've got the area, force it to update
  //by sending mouse messages to it.
  x:=0;
  y:=0;
  while x < r.Right do begin
    while y < r.Bottom do begin
      SendMessage(hNotificationArea, WM_MOUSEMOVE, 0, (y shl 16) + x);
      y:=y+5;
    end;
    x:=x+5;
  end;
end;  
使用
.... 也许并非所有这些都是必要的,但jwawinuser至少是。。。。
JwaTlHelp32{用于运行进程},
JwaWinType{对于进程声明},
JwaWinBase{只是一个猜测:对于关闭进程句柄},
JwaWinSvc{对于服务声明,始终是必需的},
jwawinuser{用于清除托盘图标/通知区域},
....
程序清洗系统托盘;
{说明从系统托盘/通知区域清除死区图标}
变量
HNOTICATIONARA:HWND;
r:RECT;
x:整数;
y:整数;
开始
HNOTICATIONAREA:=FindWindowEx(
FindWindowEx(FindWindowEx)(FindWindowEx
(0,0,'Shell_TrayWnd',''),0,'TrayNotifyWnd','',0,'SysPager','',
0,
'工具栏窗口32',
“通知区”);
GetClientRect(hNotificationArea,r);
//现在我们有了这个区域,强迫它更新
//通过向它发送鼠标消息。
x:=0;
y:=0;
当x
根据Windows中的实现细节,将鼠标移到这些图标上是一种怪癖,如果它们是隐藏的图标,则不起作用。但是,您确实应该修复崩溃的应用程序,并保留图标。这也被给出了。没有什么东西会崩溃。服务正在启动并继续运行。我只是不想把图标放在托盘里。不幸的是,我再也没有服务的源代码了。如果进程仍然在运行,那么移动它不会改变任何事情。只有当创建的进程不再运行时,图标才会在鼠标事件中消失。你说得对。我做了一些挖掘,结果发现我们正在执行一个来自Inno的程序来启动服务。该程序正在推出图标,而不是服务。所有这些都是多年前离开公司的人做的。我真正需要的是直接从Inno启动服务,避免整个混乱。但我宁愿相信你。