Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

Previous Book Contents Book Index Next

Inside Macintosh: Processes
Chapter 2 - Process Manager / Process Manager Reference
Routines / Launching Applications and Desk Accessories


You can use the LaunchApplication function to launch an application.

FUNCTION LaunchApplication (LaunchParams: LaunchPBPtr): OSErr;

A pointer to a launch parameter block specifying information about the application to launch.

  --> launchBlockID		Integer		Extended block
  --> launchEPBLength		LongInt		Length of following fields
  --> launchFileFlags		Integer		Finder flags for the application file
  --> launchControlFlags	LaunchFlags	Flags for launch options
  --> launchAppSpec		FSSpecPtr	Location of application file to launch
  <-- launchProcessSN		ProcessSerialNumber
    						Process serial number
  <-- launchPreferredSize	LongInt		Preferred application partition size
  <-- launchMinimumSize 	LongInt		Minimum application partition size
  <-- launchAvailableSize	LongInt		Maximum available partition size
  --> launchAppParameters	AppParametersPtr
  						High-level event for launched application

The LaunchApplication function launches the application from the specified file and returns the process serial number, preferred partition size, and minimum partition size if the application is successfully launched.

Note that if you launch another application without terminating your application, the launched application is not actually executed until you make a subsequent call to WaitNextEvent or EventAvail.

Set the launchContinue flag in the launchControlFlags field of the launch parameter block if you want your application to continue after the specified application is launched. If you do not set this flag, LaunchApplication terminates your application after launching the specified application, even if the launch fails.

The trap macro and registers on entry and exit for LaunchApplication are
Trap macro
Registers on entry
A0Pointer to launch parameter block
Registers on exit
A0Pointer to launch parameter block
D0Result code

noErr0No error
memFullErr-108Not enough memory to allocate the partition size specified in the 'SIZE' resource
memFragErr-601Not enough room to launch application with special requirements
appModeErr-602Memory mode is 32-bit, but application is not 32-bit clean
appMemFullErr-605More memory is required for the partition size than the amount specified in the 'SIZE'resource
appIsDaemon-606Application runs only in the background, and launch flags don't allow background-only applications

Previous Book Contents Book Index Next

© Apple Computer, Inc.
17 JUN 1996