• 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 ...
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
  • Mikalai Zaikin

Single Instance app, need to access object outside the scope

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?

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.
Please enjoy this holographic presentation of our apocalyptic dilemma right after this tiny ad:
a bit of art, as a gift, that will fit in a stocking
    Bookmark Topic Watch Topic
  • New Topic