Re: Cocoa daemon
Re: Cocoa daemon
- Subject: Re: Cocoa daemon
- From: Ryan McGann <email@hidden>
- Date: Thu, 13 Nov 2003 00:07:44 -0800
On Nov 12, 2003, at 10:00 PM, email@hidden wrote:
1) Is it possible for an app to change state in this regard?
E.g. could a regular Cocoa app with icon in the dock be switched
into daemon mode, so that its main process keeps running but its
UI and dock icon go away?
The Carbon framework contains this ability in 10.3. I'm not sure, but
it will probably work on Cocoa applications as well, since it probably
just calls through to some CoreGraphics function. Look inside
Processes.h for a function called TransformProcessType.
2) If the app is created as a daemon but contains AppKit,
can it still (say, responding to an AppleEvent) come to the
foreground, put up a menu bar & UI, etc?
Look at the comments from TransformProcessType in the header. As long
as it works on a Cocoa application, it sounds like this will suit your
needs.
A couple of notes however:
- Your application will only run when a user is logged in. When the
user logs out, your process will be killed. When another user logs in
(via Fast User Switching), the system will launch another instance of
your application, so you must be able to deal with multiple instances
of your application runing and possibly communicating eachother (a feat
not easily accomplished).
- You will need some way of launching your application. On Jaguar and
other 10.x systems you must use LoginWindow items which are launched
when the user logs in. Under Panther a new API exists, but its APIs
have not been made public yet. You cannot use StartupItems because you
need to link against the Cocoa framework, which is not possible from
StartupItems (because the Cocoa framework can only be used when a user
is logged in).
- There's no need to call daemon() since you will be a real
application, not a daemon.
-- Ryan
Ryan McGann
Macintosh Internet Security
Symantec Corporation
email@hidden
Office: email@hidden
_______________________________________________
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.