• 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: Terminating another application.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Terminating another application.


  • Subject: Re: Terminating another application.
  • From: has <email@hidden>
  • Date: Fri, 18 Jan 2008 18:32:00 +0000

John Stiles wrote:

Or use AppleScript/AppleEvents, which have a built-in "quit" message for
any regular app.


Example:

-(OSStatus)quitApplicationWithBundleID:(NSString *)bundleID {
    OSStatus err;
    AppleEvent event, reply;

    const char *bundleIDString = [bundleID UTF8String];

    err = AEBuildAppleEvent(kCoreEventClass, kAEQuitApplication,
                            typeApplicationBundleID,
                            bundleIDString, strlen(bundleIDString),
                            kAutoGenerateReturnID, kAnyTransactionID,
                            &event, NULL, "");

    if (err) return err;
    err = AESendMessage(&event, &reply, kAENoReply, kAEDefaultTimeout);
    AEDisposeDesc(&event);
    return err;
}

has
--
http://appscript.sourceforge.net
http://rb-appscript.rubyforge.org

_______________________________________________

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


  • Prev by Date: Re: Force NSOpenPanel's -panel:shouldShowFilename: to get called again?
  • Next by Date: Re: Force NSOpenPanel's -panel:shouldShowFilename: to get called again?
  • Previous by thread: Re: Terminating another application.
  • Next by thread: Check ability to write to nonexistent directory
  • Index(es):
    • Date
    • Thread