Hi Martin, One way to do it is via flock():
http://developer.apple.com/library/mac/#documentation/darwin/reference/manpages/man2/flock.2.html -- Tito On May 11, 2011, at 6:04 PM, Dave DeLong wrote: > There are a bunch of ways to do this, but the general principle is that when > an instance of the app starts, it makes its presence known somehow (touching > a file, broadcasting a distributed notification, vending a distributed > object, etc). Then when a second instance starts, it tries to find a > previous instance (looking for the file, broadcasting a distributed > notification and waiting for a response, connecting to a distributed object, > etc). If it finds one, it kills itself. > > Dave > > On May 11, 2011, at 2:02 PM, Martin Batholdy wrote: > >> Hi, >> >> My program consists of a menu item and is NSUIagent - so it is hidden in the >> Mac OS app-bar. >> >> Now what surprises me is that I am able to open several instances of this >> program. >> Every time I click on the app-file a new symbol appears and I have a new >> instance of my program running. >> >> How can I prevent this? >> (so that system-wide you can only have one instance of the program running) >> >> Is there a build-option in xCode for this? >> >> >> thanks!_______________________________________________ >> >> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) >> >> Please do not post admin requests or moderator comments to the list. >> Contact the moderators at cocoa-dev-admins(at)lists.apple.com >> >> Help/Unsubscribe/Update your Subscription: >> http://lists.apple.com/mailman/options/cocoa-dev/davedelong%40me.com >> >> This email sent to davedel...@me.com > > _______________________________________________ > > Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) > > Please do not post admin requests or moderator comments to the list. > Contact the moderators at cocoa-dev-admins(at)lists.apple.com > > Help/Unsubscribe/Update your Subscription: > http://lists.apple.com/mailman/options/cocoa-dev/tciuro%40mac.com > > This email sent to tci...@mac.com _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com