Do something like:
CFMessagePortRef identityPort = CFMessagePortCreateLocal(NULL, CFSTR("
com.mycompany.myapplication.unique"), NULL, NULL, NULL);
if(identityPort == NULL) {
    printf(stderr, "Application is already launched\n");
    exit(1);
} // else keep this port around, it will be destroyed once the application
exits

-- 
Julien

On Tue, Mar 4, 2008 at 9:27 AM, ADIL SALEEM <[EMAIL PROTECTED]> wrote:

> Hi,
>
>  I have made an application in Cocoa. From GUI it's multiple instances can
> not be launched. However, from command shell, multiple instances of the
> application can be launched.
>
>  I want to run only one instance of my application at a time. It should
> not be able to create multiple instances even from the command prompt.
>
>  Please guide me how can i achieve that ? Thanx in advance.
>
>  ADIL
>
>
> ---------------------------------
> Looking for last minute shopping deals?  Find them fast with Yahoo!
> Search.
> _______________________________________________
>
> 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/jjalon%40gmail.com
>
> This email sent to [EMAIL PROTECTED]
>
_______________________________________________

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 [EMAIL PROTECTED]

Reply via email to