Contents

LSOpenApplication(_:_:)

Launches the specified app.

Declaration

func LSOpenApplication(_ appParams: UnsafePointer<LSApplicationParameters>!, _ outPSN: UnsafeMutablePointer<ProcessSerialNumber>!) -> OSStatus

Parameters

  • inAppParams:

    A Lsapplicationparameters structure specifying the application to launch and its launch parameters. This parameter cannot be NULL.

  • outPSN:

    On input, a pointer to a value of type ProcessSerialNumber that, on return, contains the process serial number (PSN) of the application specified by inAppParams, or NULL if you don’t want to receive the PSN.

Return Value

A result code; see Result Codes.

Discussion

The LSOpenApplication launches one application. This function is an updated alternative to the Process Manager's LaunchApplication function. Launch arguments are specified in the inAppParams argument, which must be supplied. If the application is already running in the current session, it is made the front process (unless the kLSLaunchNewInstance flag is used, which always causes a new process to be created).

If outPSN is not NULL, on return, the structure it points to contains the PSN of the launched (or activated) process. Note that for asynchronous launches, the application may not have finished launching when this function returns.

Version-Notes

Thread-safe since OS X v10.4.

See Also

Deprecated Functions