本文介绍了如何在explorer.exe崩溃后重新添加图标到系统托盘的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的java应用程序当前在系统托盘中有一个图标。然而,当系统托盘崩溃时(您可以通过在任务栏中杀死explorer.exe来模拟此错误),系统托盘返回后图标会消失。

My java application currently has an icon in the system tray. When the system tray crashes, however (you can simulate this by killing explorer.exe in the taskbar), the icon disappears after the system tray returns.

当我检查SystemTray .getSystemTray()。getTrayIcons()为系统托盘中的图标,它总是显示我的TrayIcon仍然在系统托盘中,即使它崩溃和重新加载,我的托盘图标更长。

When I check SystemTray.getSystemTray().getTrayIcons() for the icons in the system tray, it always shows that my TrayIcon is still in the system tray, even though after it crashes and reloads and my tray icon is longer there.

目前,我每15秒左右删除和添加我的图标一次,但是有任何其他方式实现,以便它不会不断消失,出现和恼人的用户?

At the moment I'm removing and adding my icon once every 15 seconds or so, but is there any other way of implementing this so that it won't keep disappearing and appearing and annoying the user?

推荐答案

为了防止任何人绊倒这个并想知道发生了什么,最后我不得不坚持删除和添加图标后几秒钟,因为Windows不会更新JVM对托盘图标的状态...这自然不是最好的方法来解决它,但似乎没有一个更好的方法。

Just in case anyone else stumbles across this and wonders what happened, in the end I had to stick with removing and adding the icon after a few seconds, because Windows does not update the JVM on the status of the tray icons... It was naturally not the best way to fix it, but there didn't seem to be a better way.

这篇关于如何在explorer.exe崩溃后重新添加图标到系统托盘的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-23 12:16