Re: Forcing an application into the foreground
Re: Forcing an application into the foreground
- Subject: Re: Forcing an application into the foreground
- From: Douglas Davidson <email@hidden>
- Date: Wed, 02 Mar 2005 14:34:40 -0800
On 2005-03-02 14:08:58 -0800 John Stiles <email@hidden> wrote:
It is illegal to launch a Cocoa/Carbon app via a BSD call like
fork/exec. You
will get goofy unspecified behavior, and the fact that it's not
coming to the
foreground is in fact one of those symptoms. (Another symptom I've
seen is
that the menubar sometimes fails to draw.)
This simply isn't true. You can launch an application via
fork/exec--for example, you can run an application from an interactive
shell by executing its main executable. However, you must make sure
that the exec specifies sufficient information for the application to
locate its executable using argv[0]. The easiest way to ensure this
is by passing a full correct absolute path for your argv[0], for
example by duplicating the first argument of execl().
You need to use NSWorkspace or Launch Services to launch your app.
It certainly is easier to use NSWorkspace or Launch Services to launch
an application, and it will probably give less trouble in general.
However, there are certain situations in which one wishes for example
to specify arguments, or environment variables, for which a fork/exec
may be more suitable.
Douglas Davidson
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden