I need to develop an application, basically the application is simple, when the application is launched for the first time it should be loaded in the system tray of windows [This application is meant only for windows os]. If the application is called once again, then it shouldn't launch another new instance, but it should show a balloon message in the first instance of the application launched.
I can take care of the instance and I can use some libraries for getting the icon in the system tray, but how can I show the balloon message when the application is launched when a previous instance is there. That is, to show an balloon message in the system tray object created by the first instance, I need that object but how can I get the object in the second instance of the application. I am using TrayIcon for the system tray display and the class dosen't support Serialization, so I can't serialize the object.
That description sounds a bit like "Who's on First", but here is the usual way one stops an application being launched more than once on a machine:
1. Have the application create a server socket at a specific port #. If it can't acquire that port then it terminates itself.
2. If you want the first instance to notice the thwarted launch of the second instance, the second instance can always create a client socket and write something after failing to acquire that port for a server socket.
There is no emoticon for what I am feeling!
Nothing up my sleeve ... and ... presto! A tiny ad: