Re: Termination Running Applications ...
Mic Pringle wrote: Is it possible to terminate other running applications (not my own) from within my application ? OSStatus QuitApplicationProcessWithPID(pid_t pid) { AppleEvent evt, res; AEDesc errDesc; OSStatus err; // build and send a 'quit' event err = AEBuildAppleEvent(kCoreEventClass, kAEQuitApplication, typeKernelProcessID, &pid, sizeof(pid), kAutoGenerateReturnID, kAnyTransactionID, &evt, NULL, ""); if (err) return err; err = AESendMessage(&evt, &res, kAEWaitReply, kAEDefaultTimeout); AEDisposeDesc(&evt); // note: process may quit without replying if (err == connectionInvalid) return noErr; if (err) return err; // check if reply event contains an error number, e.g. userCanceledErr err = AEGetParamDesc(&res, keyErrorNumber, typeSInt32, &errDesc); if (err == noErr) { AEGetDescData(&errDesc, &err, sizeof(err)); AEDisposeDesc(&res); } else if (err == errAEDescNotFound) err = noErr; return err; } HTH has -- Control AppleScriptable applications from Python, Ruby and ObjC: http://appscript.sourceforge.net ___ 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
Re: Termination Running Applications ...
On 3/18/09 2:41 PM, Mic Pringle said: >I'm currently working on a project where one of it's features is to >display a lift of running applications. This information is sourced >from NSWorkspace. However, I'd also like to give the user the option >to close any of these applications without having to leave mine. Is >this at all possible ? Google for "quit appleevent". You'll want to send one to the app you want to quit. It provides the option for the user to save unsaved changes. -- Sean McBride, B. Eng s...@rogue-research.com Rogue Researchwww.rogue-research.com Mac Software Developer Montréal, Québec, Canada ___ 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
Termination Running Applications ...
Hi, Is it possible to terminate other running applications (not my own) from within my application ? I'm currently working on a project where one of it's features is to display a lift of running applications. This information is sourced from NSWorkspace. However, I'd also like to give the user the option to close any of these applications without having to leave mine. Is this at all possible ? Thanks, -Mic Pringle ___ 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