• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: stopping an application
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: stopping an application


  • Subject: Re: stopping an application
  • From: Bill Janssen <email@hidden>
  • Date: Mon, 13 Apr 2009 17:45:54 PDT
  • Comments: In-reply-to "Luca C." <email@hidden> message dated "Mon, 13 Apr 2009 03:21:55 -0700."

"From the command line"...

Luca C. <email@hidden> wrote:

> 2009/4/13 Bill Janssen <email@hidden>
> >
> >
> > I was afraid of that...  Is there an easy way to do that from the
> > command line given its PID?
>
>
> Using an AppleEvent given the appropriate bundle id of the application is
> actually pretty easy.I have found this in one my quite old project:
>
> + (OSStatus)quitApplicationWithBundleID:(NSString *)aBundleID {
>
>   OSStatus err;
>
>   AppleEvent event, reply;
>
>   const char *bundleIDString;
>
>
>
>   bundleIDCString = [aBundleID UTF8String];
>
>
>
>   err = AEBuildAppleEvent(kCoreEventClass, kAEQuitApplication,
> typeApplicationBundleID,
>
>                           bundleIDCString, strlen(bundleIDCString),
> kAutoGenerateReturnID,
>
>                           kAnyTransactionID, &event, NULL, "");
>
>
>
>   if (err == noErr) {
>
>     err = AESendMessage(&event, &reply, kAENoReply, kAEDefaultTimeout);
>
>     AEDisposeDesc(&event);
>
>   }
>
>   return err;
>
> }
>
>
> Haven't tested with Leopard yet, but I'm sure it works there.
>
>
> HTH
>
> --Luca C.
> _______________________________________________
>
> Cocoa-dev mailing list (email@hidden)
>
> 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:
>
> This email sent to email@hidden
_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:

This email sent to email@hidden

  • Follow-Ups:
    • Re: stopping an application
      • From: "Jeremy W. Sherman" <email@hidden>
References: 
 >stopping an application (From: Bill Janssen <email@hidden>)
 >Re: stopping an application (From: Nick Zitzmann <email@hidden>)
 >Re: stopping an application (From: Bill Janssen <email@hidden>)
 >Re: stopping an application (From: "Luca C." <email@hidden>)

  • Prev by Date: Re: stopping an application
  • Next by Date: Re: Best way to get a non-repeating random number?
  • Previous by thread: Re: stopping an application
  • Next by thread: Re: stopping an application
  • Index(es):
    • Date
    • Thread