[comp.sys.mac] Calling DAHandler

raylau@dasys1.UUCP (Raymond Lau) (10/27/87)

OK...since my MultiFinder pkg was lost by FedEx and I'm waiting for a replacement, here're two simple questions:

How do you tell if MF is running?  (I don't care if I'm in the background or fore...)  I'd guess one can't just check for WNE as it may be added in later to do nothing but call SystemTask and GNE when not under MF...

Assuming that I've discovered that MF is running.  I want to have MF sublaunch DA Handler, if it isn't already loaded....and then make it the active application.  (without opening a real DA).  Any ideas on how to do this?  This is needed to make a FKEY I have compatible w/MF - it is compatible w/DA Handler but not when other applications are active.  I guess I'd need a way of deactivating DA Handler when I'm through - if it wasn't the active application when I started.

This has to be done in LightspeedC...but Pascal examples are fine...or just an outline of what to call, what globals to use, etc...

Thanks,

lsr@apple.UUCP (Larry Rosenstein) (11/03/87)

In article <1815@dasys1.UUCP> raylau@dasys1.UUCP (Raymond Lau) writes:
>
>How do you tell if MF is running?  (I don't care if I'm in the background
>or fore...)  I'd guess one can't just check for WNE as it may be added in
>later to do nothing but call SystemTask and GNE when not under MF...

What Tech Note #158 says is that applications should not care whether
Multifinder is running or not.  Instead, you should check for the specific
services that Multifinder provides, if your application need to use them.

There are 2 such services: (1) WaitNextEvent and (2) Temporary Memory
Allocation.

To test for WNE, you simply test that the WNE trap is implemented.
WaitNextEvent is Toolbox trap $60 (trap word $A860).

To test for temporary memory allocation calls, you test that the Multifinder
dispatch trap (Toolbox $8F) is implemented, and that Switcher is not
running.  (Look at the 4-bytes at location $282; it must be 0 or -1.)

Neither of these tests should be used to tell if Multifinder is running.
This is especially true of WNE, since that might be provided in a future
System, whether Multifinder is present or not.

There is 1 other service that Multifinder provides, which applications might
want to test for.  That is whether the Launch trap will return or not, when
you do a sublaunch.  (It will return is Multifinder is running.)

An application might want to do some clean up if the Launch trap is not
going to return. For example, when MPW launches an application, it does not
do its normal clean up if Multifinder is running.

Right now, there is no defined way to test for this particular service.  We
don't want to encourage applications to do sublaunching (see Tech Note #126
for details).  I talked to one of the Multifinder people, and he said that a
future version of SysEnvirons might include a bit to indicate if this
service is available.  

>Assuming that I've discovered that MF is running.  I want to have MF
>sublaunch DA Handler, if it isn't already loaded....and then make it the
>active application.  (without opening a real DA).  Any ideas on how to do
>this?  This is needed to make a FKEY I have compatible w/MF - it is
>compatible w/DA Handler but not when other applications are active.  I
>guess I'd need a way of deactivating DA Handler when I'm through - if it
>wasn't the active application when I started.

The interface between Multifinder and the DA Handler is not defined, which
mean there is not way to know what environment and parameters the DA Handler
expects.  

When you sublaunch a normal application, it will become the active
application (if the Launch succeeds).  After you do the Launch, however, you
have no control over the application.  Also, the layer/appliation management
routines in Multifinder are not available to applications, so there is no
way to change which appliation is active.


-- 
Larry Rosenstein

Object Specialist
Apple Computer

AppleLink: Rosenstein1
UUCP:  {sun, voder, nsc, mtxinu, dual}!apple!lsr
CSNET: lsr@Apple.com