[comp.sys.mac.programmer] Sub-launching in the background

mark@cs.glasgow.ac.uk (Mark Dunlop) (06/01/90)

This may appear to be a very strange question but...

  Can I sublaunch an application when I am currently in the background?

I know that sublaunching is not something that really nice programmers
should do, but I really want to do it and I'll do it nicely!

The problem is that I use the code from "TN 126 - Sub(Launching) from
High-Level Languages" which allows the user to select an application
to launch (using FSopen) and will then sublaunch or launch depending
on a program provided parameter. This works perfectly, I then changed
the code so that the FSOpen was not used but the vRefNum and fname
were provided. All worked fine, launching was no problem whether my
application was in the foreground or the background.

When I then tried to sublaunch it went OK when my program was in the 
foreground but as soon as I tried to sublaunch from the background
bang! My two applications ran fine but the Finder (current foreground
application) stopped accepting events.

I even went to the extreme of splitting the original code so the FSopen
was independent from the Launch so that I could swap to the Finder in
between -- exactly the same behaviour.

Can anybody help me with this one?

Mark Dunlop

PS: `What a silly thing to do' / `you should not do this' is
    not really what I call help unless you have good reasons.

PPS: I am using THINK Pascal 2 (2.03 I think, I think it was the last UK
     release before version 3)
-- 
Mail:  Mark Dunlop, Department of Computing Science, 
       University Of Glasgow, Glasgow G12 8QQ, Scotland, UK.
ARPA:  mark%cs.glasgow.ac.uk@nsfnet-relay.ac.uk USENET: mark@cs.glasgow.uucp
--- There is an old research student saying: "to photocopy is to learn"  ---