Launch
- Chain
- SFGetFile
- SetVol
- Launching Another Application Under System 6
- Launching Another Application with a Document Under System 6
Launch
Terminate, purge heap, and execute an application Expects: (A0) is a pointer to a p-string of application file to launch.
4(A0) indicates how to configure sound and screen buffers.
The file to launch is on the current volume (see SetVol).
Notes: Launch discards all information in the application heap except for a handle leading to the desk scrap.
The word At 4(A0) should be set as follows:
0 Configure to provide only the main sound and screen buffers ( provide
the largest amount of memory possible)
>0 Configure for the main screen buffer and the alternate sound buffer
<0 Configure for the both the alternate sound and alternate screen to be
allocated (least available RAM)
Launching under MultiFinder behaves differently than Finder. The
application that is sublaunched becomes the foreground application. When
the user quits that application, the System returns control to the next
frontmost layer, not necessarily your application.
If you set both high bits of the LaunchFlags(which request a sublaunch),
your application will continue to execute after the call to _Launch. Under,
MultiFinder the actual launch will not happen in the _Launch trap, but after
a call to _WaitNextEvent.
Under MultiFinder, _Launch currently returns an error: 1) if there is not
enough memory to launch the specified application; 2) if it can't locate the
specified application or; 3) if the specified application is already open. In
the last case, the application will not be made active. If sublaunching fails,
control will return to your application and you must report the error.
Currently, errors( values <0) are returned in register D0, values >=0
signal a successful sublaunch.
Example
Warning:
Although this example covers sublaunching, Developer Technical Support
strongly recommends not using this feature. Sublaunching will change in
the future. You should only use it in an integrated environment and if you
are prepared to deal with a revision every time Apple releases new versions
of the System Software.
DoLaunch( filename, 0 ); [TOKEN:12074] launch the program */
/* ====== the DoLaunch routine (uses inline ASM code) ======
*/
void DoLaunch(Ptr theApp, shortmemCode ) {
struct { /* temporary structure */
Ptr appName; /* the name of the launchee */ short memUse; /* config. param. see above Notes */
char lc[2]; /* extended parameters */
long extBlocLen; /* # bytes in extension(6) */
short fFlags; /* Finder file info flags */
long launchFlags; /* bit 31,30==1 for sublaunch */
} LaunchRec;
LaunchRec.appName = theApp;
LaunchRec.launchFlags = memCode;
asm {
lea LaunchRec, A0
_Launch
}
}