This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
I created a java application which create a tray icon and do some operation. And I wrapped it in an exe by JSmooth.
But when I stopped the application from task manager the orphaned icon still there in system tray until I move the cursor over it.
Is there any way we can refresh the tray icons by java code ??
No. First - if you kill an app from TaskManager it ends abruptly, so it wouldn't go through normal shutdown procedures. Second, this same thing happens whenever you shutdown an app from the task manager. So it seems to be a Windows thing and not detecting that the process behind the icon is dead until it is moused over.
Joined: Jun 17, 2008
Thanks, is there any way I can shutdown my exe normally means it should remove the icon from system tray?
The situation is - I bundled my java class in JSmooth exe wrapper and running it by command "Test start". it started properly.
To stop this exe I issue command "Test stop" which create another instance of Test.exe and shutdown the running process by command "TASKKILL /F Test.exe".
Is there any better way so I can shutdown the Test.exe gracefully ? I need it urgently..Please help...
You should add a menu to the tray icon with a command that signals the end of the application. How that signal should be implemented depends a lot on the application itself and what it does. How to make the tray icon menu depends on the library you are using for creating the tray icon (if you are using Java6's java.awt.TrayIcon then you would pass it a java.awt.PopupMenu menu items.)
Joined: Jun 17, 2008
Hi, there is already a menu item called "Exit", when user clicks it, it works perfectly. But there is another way to start and stop the application with command "start" and "stop".
In that case "stop" creating the problem, it stops the process but icon remains in the system tray until touched by cursor.