Re: getting the app name of an app that quits
Re: getting the app name of an app that quits
- Subject: Re: getting the app name of an app that quits
- From: Scott Anguish <email@hidden>
- Date: Sun, 31 Aug 2003 01:54:02 -0400
On Aug 30, 2003, at 2:35 PM, email@hidden wrote:
i need to know when a certain program quits. so far, i register with
the notification center to find out when an app quits
...
CurrentAppsSharedWorkspace = [NSWorkspace sharedWorkspace];
WorkspaceNotificationCenter = [CurrentAppsSharedWorkspace
notificationCenter];
[WorkspaceNotificationCenter addObserver:self
selector:@selector(gameOver:)
name:@"NSWorkspaceDidTerminateApplicationNotification"
object:nil];
...
and gameOver: gets called fine and all but i need to know the
applications name to filter them out. any ideas how i can do this?
object is the only method in nsnotification i see that could help but
what would it return in my case?
Notifications get an object, and a UserInfo dictionary. And it's that
dictionary that contains what you are seeking! You can get the name,
path, process identifier and the high/low of the PSN.
From NSWorkspace...
NSWorkspaceDidTerminateApplicationNotification
Posted when an application finishes executing.
The notification object is the shared NSWorkspace instance. The
userInfo dictionary contains the keys and values described in
Constants.
That constants link gets you to what you want (the third table in the
constants contains the key definitions and return types)
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.