1

我使用 inno setup 来设置我的应用程序。在安装之前,我会检查应用程序是否仍在运行,并使用 taskkill 命令杀死应用程序强制。但我发现托盘图标不会消失。

杀死后如何温和地终止应用程序或使托盘图标从托盘中删除?

4

1 回答 1

2

I had the exact same problem, and fixed it with a simple change to my bat file and without having to install any other programs.

The problem was I was running taskkill with /f wich forces (hard) kills the task. If you kill it without the /f it sends a close signal to the application, the application exits cleanly and removes its system tray icon.

In my bat file I do two taskkill commands; the first without the /f and then again with the /f. If the first one works (which it usually should) then all is well and the system tray icon goes away. If for some reason the first one fails, the the second one will still kill it, although in that case the system tray icon would not be removed.

So, in my case, I use:
taskkill /t /im Memu*
taskkill /f /t /im Memu*

Works great :-)

于 2019-11-09T01:54:54.370 回答