• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Single Instance app, need to access object outside the scope

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.

Can any one guide me in this?

Thanks
 
Ranch Hand
Posts: 1780
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
If I had asked people what they wanted, they would have said faster horses - Ford. Tiny ad:
Clean our rivers and oceans from home
https://www.kickstarter.com/projects/paulwheaton/willow-feeders
reply
    Bookmark Topic Watch Topic
  • New Topic