Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
General
GeneralPortable MacsHardwareNetworking
Applications
Mac ApplicationsEudoraFirefox / MozillaInternet ExplorerOutlook ExpressMS OfficeEntourageExcelPowerPointWordVirtual PCMedia PlayerOther MS Products
Programming
Mac ProgrammingCodeWarriorPerl
Country Specific
Australian Mac GroupUK Mac Group

Mac Forum / Programming / Mac Programming / July 2008



Tip: Looking for answers? Try searching our database.

terminate application

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
p2 - 17 Jul 2008 11:39 GMT
Hi

How can i terminate application from other application ? not kill ?

p2
Gregory Weston - 17 Jul 2008 14:35 GMT
In article
<1fec09ae-84d2-417f-ba3a-59eef7f87850@w7g2000hsa.googlegroups.com>,

> Hi
>
> How can i terminate application from other application ? not kill ?

If it's a normal, full-citizen Mac app, you send it a quit AppleEvent.

OSErr QuitApplicationByPSN(const ProcessSerialNumber* inPSN)
{
  AppleEvent theQuitEvent = {typeNull, NULL};
  AEBuildError theBuildError;
  OSErr theError = AEBuildAppleEvent(kCoreEventClass,
kAEQuitApplication,
                             typeProcessSerialNumber, inPSN,
                             sizeof(ProcessSerialNumber),
                             kAutoGenerateReturnID,
                             kAnyTransactionID,
                             &theQuitEvent,
                             &theBuildError,"");
  if(theError == noErr)
  {
     AppleEvent theReply = {};
     theError = AESend(&theQuitEvent, &theReply, kAENoReply |
kAENeverInteract,
                   kAENormalPriority, kNoTimeOut, NULL, NULL);
     (void)AEDisposeDesc(&theQuitEvent);
  }
  return theError;
}

How you get the ProcessSerialNumber to pass in depends on what you
already have.

Signature

"Harry?" Ron's voice was a mere whisper. "Do you smell something ... burning?"
  - Harry Potter and the Odor of the Phoenix

p2 - 18 Jul 2008 13:10 GMT
> In article
> <1fec09ae-84d2-417f-ba3a-59eef7f87...@w7g2000hsa.googlegroups.com>,
[quoted text clipped - 35 lines]
> "Harry?" Ron's voice was a mere whisper. "Do you smell something ... burning?"
>    - Harry Potter and the Odor of the Phoenix

thanks

p2
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.