Mac OS 9
Processes.h File Reference

Process Manager Interfaces. More...

#include <MacTypes.h>
#include <Events.h>
#include <Files.h>
#include <TextCommon.h>
#include <CFString.h>

Go to the source code of this file.

Data Structures

struct  ProcessSerialNumber
 
struct  AppParameters
 
struct  LaunchParamBlockRec
 
struct  ProcessInfoRec
 
struct  ProcessInfoExtendedRec
 
struct  SizeResourceRec
 

Macros

#define NewControlPanelDefUPP(userRoutine)
 
#define DisposeControlPanelDefUPP(userUPP)   DisposeRoutineDescriptor(userUPP)
 
#define InvokeControlPanelDefUPP(message, item, numItems, cPanelID, theEvent, cdevValue, cpDialog, userUPP)
 
#define NewControlPanelDefProc(userRoutine)   NewControlPanelDefUPP(userRoutine)
 
#define CallControlPanelDefProc(userRoutine, message, item, numItems, cPanelID, theEvent, cdevValue, cpDialog)
 

Typedefs

typedef struct ProcessSerialNumber ProcessSerialNumber
 
typedef ProcessSerialNumberProcessSerialNumberPtr
 
typedef unsigned short LaunchFlags
 
typedef struct AppParameters AppParameters
 
typedef AppParametersAppParametersPtr
 
typedef struct LaunchParamBlockRec LaunchParamBlockRec
 
typedef LaunchParamBlockRecLaunchPBPtr
 
typedef struct ProcessInfoRec ProcessInfoRec
 
typedef ProcessInfoRecProcessInfoRecPtr
 
typedef struct ProcessInfoExtendedRec ProcessInfoExtendedRec
 
typedef ProcessInfoExtendedRecProcessInfoExtendedRecPtr
 
typedef struct SizeResourceRec SizeResourceRec
 
typedef SizeResourceRecSizeResourceRecPtr
 
typedef SizeResourceRecPtrSizeResourceRecHandle
 
typedef short item
 
typedef short short numItems
 
typedef short short short cPanelID
 
typedef short short short EventRecordtheEvent
 
typedef short short short EventRecord long cdevValue
 
typedef short short short EventRecord long DialogPtr cpDialog
 

Enumerations

enum  { kNoProcess = 0 , kSystemProcess = 1 , kCurrentProcess = 2 }
 
enum  {
  launchContinue = 0x4000 , launchNoFileFlags = 0x0800 , launchUseMinimum = 0x0400 , launchDontSwitch = 0x0200 ,
  launchAllow24Bit = 0x0100 , launchInhibitDaemon = 0x0080
}
 
enum  { extendedBlock = 0x4C43 , extendedBlockLen = sizeof(LaunchParamBlockRec) - 12 }
 
enum  {
  modeReserved = 0x01000000 , modeControlPanel = 0x00080000 , modeLaunchDontSwitch = 0x00040000 , modeDeskAccessory = 0x00020000 ,
  modeMultiLaunch = 0x00010000 , modeNeedSuspendResume = 0x00004000 , modeCanBackground = 0x00001000 , modeDoesActivateOnFGSwitch = 0x00000800 ,
  modeOnlyBackground = 0x00000400 , modeGetFrontClicks = 0x00000200 , modeGetAppDiedMsg = 0x00000100 , mode32BitCompatible = 0x00000080 ,
  modeHighLevelEventAware = 0x00000040 , modeLocalAndRemoteHLEvents = 0x00000020 , modeStationeryAware = 0x00000010 , modeUseTextEditServices = 0x00000008 ,
  modeDisplayManagerAware = 0x00000004
}
 
enum  {
  kQuitBeforeNormalTimeMask = 1 , kQuitAtNormalTimeMask = 2 , kQuitBeforeFBAsQuitMask = 4 , kQuitBeforeShellQuitsMask = 8 ,
  kQuitBeforeTerminatorAppQuitsMask = 16 , kQuitNeverMask = 32 , kQuitOptionsMask = 0x7F , kQuitNotQuitDuringInstallMask = 0x0100 ,
  kQuitNotQuitDuringLogoutMask = 0x0200
}
 
enum  {
  initDev = 0 , hitDev = 1 , closeDev = 2 , nulDev = 3 ,
  updateDev = 4 , activDev = 5 , deactivDev = 6 , keyEvtDev = 7 ,
  macDev = 8 , undoDev = 9 , cutDev = 10 , copyDev = 11 ,
  pasteDev = 12 , clearDev = 13 , cursorDev = 14
}
 
enum  { cdevGenErr = -1 , cdevMemErr = 0 , cdevResErr = 1 , cdevUnset = 3 }
 
enum  { uppControlPanelDefProcInfo = 0x000FEAB0 }
 

Functions

OSErr LaunchApplication (LaunchPBPtr LaunchParams)
 
OSErr LaunchDeskAccessory (const FSSpec *pFileSpec, ConstStr255Param pDAName)
 
OSErr MacGetCurrentProcess (ProcessSerialNumber *PSN)
 
OSErr GetFrontProcess (ProcessSerialNumber *PSN)
 Get serial number of foreground process. More...
 
OSErr GetNextProcess (ProcessSerialNumber *PSN)
 Get the process serial number of the next process. More...
 
OSErr GetProcessInformation (const ProcessSerialNumber *PSN, ProcessInfoRec *info)
 
OSErr SetFrontProcess (const ProcessSerialNumber *PSN)
 Make a process the foreground process. More...
 
OSErr WakeUpProcess (const ProcessSerialNumber *PSN)
 Make a process eligible to receive CPU time. More...
 
OSErr SameProcess (const ProcessSerialNumber *PSN1, const ProcessSerialNumber *PSN2, Boolean *result)
 Compare two process serial numbers. More...
 
void ExitToShell (void)
 
OSErr LaunchControlPanel (const FSSpec *pFileSpec)
 
TextEncoding GetApplicationTextEncoding (void)
 
ScriptCode GetApplicationScript (void)
 
OSStatus GetProcessBundleLocation (const ProcessSerialNumber *psn, FSRef *location)
 
OSStatus CopyProcessName (const ProcessSerialNumber *psn, CFStringRef *name)
 
Boolean IsProcessVisible (const ProcessSerialNumber *psn)
 
OSErr ShowHideProcess (const ProcessSerialNumber *psn, Boolean visible)
 
typedef CALLBACK_API (long, ControlPanelDefProcPtr)(short message
 
typedef STACK_UPP_TYPE (ControlPanelDefProcPtr) ControlPanelDefUPP
 
ControlPanelDefUPP NewControlPanelDefUPP (ControlPanelDefProcPtr userRoutine)
 
void DisposeControlPanelDefUPP (ControlPanelDefUPP userUPP)
 
long InvokeControlPanelDefUPP (short message, short item, short numItems, short cPanelID, EventRecord *theEvent, long cdevValue, DialogPtr cpDialog, ControlPanelDefUPP userUPP)
 

Detailed Description

Process Manager Interfaces.

Introduced In: Mac OS 9
Avaliable From: Universal Interfaces 3.4.1
Copyright: © 1989-2001 by Apple Computer, Inc., all rights reserved

For bug reports, consult the following page on the World Wide Web:

http://developer.apple.com/bugreporter/

Macro Definition Documentation

◆ CallControlPanelDefProc

#define CallControlPanelDefProc (   userRoutine,
  message,
  item,
  numItems,
  cPanelID,
  theEvent,
  cdevValue,
  cpDialog 
)
Value:
InvokeControlPanelDefUPP(message, item, numItems, cPanelID, theEvent, \
cdevValue, cpDialog, userRoutine)
long InvokeControlPanelDefUPP(short message, short item, short numItems, short cPanelID, EventRecord *theEvent, long cdevValue, DialogPtr cpDialog, ControlPanelDefUPP userUPP)
Definition: Events.h:224

◆ InvokeControlPanelDefUPP

#define InvokeControlPanelDefUPP (   message,
  item,
  numItems,
  cPanelID,
  theEvent,
  cdevValue,
  cpDialog,
  userUPP 
)
Value:
(long)CALL_SEVEN_PARAMETER_UPP((userUPP), uppControlPanelDefProcInfo, \
(message), (item), (numItems), (cPanelID), \
(theEvent), (cdevValue), (cpDialog))

◆ NewControlPanelDefUPP

#define NewControlPanelDefUPP (   userRoutine)
Value:
(ControlPanelDefUPP) \
NewRoutineDescriptor((ProcPtr)(userRoutine), uppControlPanelDefProcInfo, \
GetCurrentArchitecture())
UniversalProcPtr NewRoutineDescriptor(ProcPtr theProc, ProcInfoType theProcInfo, ISAType theISA)

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

Applications and background applications can control when they are asked to quit by the system at restart/shutdown by setting these bits in a 'quit' ( 0 ) resource in their application's resource fork. Applications without a 'quit' ( 0 ) will be quit at kQuitAtNormalTime mask.

Function Documentation

◆ CopyProcessName()

OSStatus CopyProcessName ( const ProcessSerialNumber psn,
CFStringRef *  name 
)

CopyProcessName()

Summary: Get a copy of the name of a process.

Discussion: Use this call to get the name of a process as a CFString. The name returned is a copy, so the caller must CFRelease the name when finished with it. The difference between this call and the processName field filled in by GetProcessInformation is that the name here is a CFString, and thus is capable of representing a multi-lingual name, whereas previously only a mac-encoded string was possible.

Parameters:

psn: Serial number of the target process

name: CFString representing the name of the process (must be released by caller with CFRelease)

Non-Carbon CFM: not available
Carbon Lib: in CarbonLib 1.5 and later
Mac OS X: in version 10.0 and later

◆ DisposeControlPanelDefUPP()

void DisposeControlPanelDefUPP ( ControlPanelDefUPP  userUPP)

DisposeControlPanelDefUPP()

Non-Carbon CFM: available as macro/inline
Carbon Lib: not available
Mac OS X: not available

◆ ExitToShell()

void ExitToShell ( void  )

ExitToShell()

Non-Carbon CFM: in InterfaceLib 7.1 and later
Carbon Lib: in CarbonLib 1.0 and later
Mac OS X: in version 10.0 and later

◆ GetApplicationScript()

ScriptCode GetApplicationScript ( void  )

GetApplicationScript()

Summary: Returns the application script.

Discussion: The application script is used when you need a ScriptCode to pass to some other API, such as UseThemeFont.

Non-Carbon CFM: not available
Carbon Lib: in CarbonLib 1.3 and later
Mac OS X: in version 10.0 and later

◆ GetApplicationTextEncoding()

TextEncoding GetApplicationTextEncoding ( void  )

GetApplicationTextEncoding()

Summary: Returns the application text encoding for Resource Manager resources.

Discussion: The application text encoding is used when you create a CFStringRef from text stored in Resource Manager resources, which typically uses one of the Mac encodings such as MacRoman or MacJapanese.

Non-Carbon CFM: not available
Carbon Lib: in CarbonLib 1.2 and later
Mac OS X: in version 10.0 and later

◆ GetFrontProcess()

OSErr GetFrontProcess ( ProcessSerialNumber PSN)

Get serial number of foreground process.

If no process is running in the foreground, GetFrontProcess returns the
result code procNotFound.
Copyright: THINK Reference © 1991-1992 Symantec Corporation
Non-Carbon CFM: in InterfaceLib 7.1 and later
Carbon Lib: in CarbonLib 1.0 and later
Mac OS X: in version 10.0 and later

◆ GetNextProcess()

OSErr GetNextProcess ( ProcessSerialNumber PSN)

Get the process serial number of the next process.

You use the GetNextProcess to get the process serial number of the next
process
PSN is a pointer to a valid process serial number returned from
LaunchApplication , GetNextProcess , GetFrontProcess , or
GetCurrentProcess , or the defined constant kNoProcess.
Returns: an operating system Error Code .
noErr(0)No error
paramErr (-50)Process serial number is invalid
procNotFound (-600)No process in the process list following the specified
process
Note
You can use the returned process serial number from this function in
other Process Manager routines. You can also use this process serial
number to specify a target application when your application sends a
high-level event.
Copyright: THINK Reference © 1991-1992 Symantec Corporation
Non-Carbon CFM: in InterfaceLib 7.1 and later
Carbon Lib: in CarbonLib 1.0 and later
Mac OS X: in version 10.0 and later

◆ GetProcessBundleLocation()

OSStatus GetProcessBundleLocation ( const ProcessSerialNumber psn,
FSRef location 
)

GetProcessBundleLocation()

Summary: Retrieve the filesystem location of the process bundle, or executable if unbundled.

Discussion: Retrieves a reference to the filesystem location of the specified application. For an application that is packaged as an app bundle, this will be the app bundle directory; otherwise it will be the location of the executable itself.

Parameters:

psn: Serial number of the target process

location: Location of the bundle or executable, as an FSRef

Non-Carbon CFM: not available
Carbon Lib: in CarbonLib 1.5 and later
Mac OS X: in version 10.0 and later

◆ GetProcessInformation()

OSErr GetProcessInformation ( const ProcessSerialNumber PSN,
ProcessInfoRec info 
)

GetProcessInformation()

Non-Carbon CFM: in InterfaceLib 7.1 and later
Carbon Lib: in CarbonLib 1.0 and later
Mac OS X: in version 10.0 and later

◆ InvokeControlPanelDefUPP()

long InvokeControlPanelDefUPP ( short  message,
short  item,
short  numItems,
short  cPanelID,
EventRecord theEvent,
long  cdevValue,
DialogPtr  cpDialog,
ControlPanelDefUPP  userUPP 
)

InvokeControlPanelDefUPP()

Non-Carbon CFM: available as macro/inline
Carbon Lib: not available
Mac OS X: not available

◆ IsProcessVisible()

Boolean IsProcessVisible ( const ProcessSerialNumber psn)

IsProcessVisible()

Summary: Determines whether a particular process is visible or not.

Discussion: Given a psn, this call will return true or false depending on whether or not the process is currently visible.

Parameters:

psn: Serial number of the process

Non-Carbon CFM: not available
Carbon Lib: in CarbonLib 1.5 and later
Mac OS X: in version 10.1 and later

◆ LaunchApplication()

OSErr LaunchApplication ( LaunchPBPtr  LaunchParams)

LaunchApplication()

Non-Carbon CFM: in InterfaceLib 7.1 and later
Carbon Lib: in CarbonLib 1.0 and later
Mac OS X: in version 10.0 and later

◆ LaunchControlPanel()

OSErr LaunchControlPanel ( const FSSpec *  pFileSpec)

LaunchControlPanel is similar to LaunchDeskAccessory, but for Control Panel files instead. It launches a control panel in an application shell maintained by the Process Manager. LaunchControlPanel()

Non-Carbon CFM: in InterfaceLib 9.0 and later
Carbon Lib: not available
Mac OS X: not available

◆ LaunchDeskAccessory()

OSErr LaunchDeskAccessory ( const FSSpec *  pFileSpec,
ConstStr255Param  pDAName 
)

LaunchDeskAccessory()

Non-Carbon CFM: in InterfaceLib 7.1 and later
Carbon Lib: not available
Mac OS X: not available

◆ MacGetCurrentProcess()

OSErr MacGetCurrentProcess ( ProcessSerialNumber PSN)

[Mac]GetCurrentProcess()

Non-Carbon CFM: in InterfaceLib 7.1 and later
Carbon Lib: in CarbonLib 1.0 and later
Mac OS X: in version 10.0 and later

◆ NewControlPanelDefUPP()

ControlPanelDefUPP NewControlPanelDefUPP ( ControlPanelDefProcPtr  userRoutine)

NewControlPanelDefUPP()

Non-Carbon CFM: available as macro/inline
Carbon Lib: not available
Mac OS X: not available

◆ SameProcess()

OSErr SameProcess ( const ProcessSerialNumber PSN1,
const ProcessSerialNumber PSN2,
Boolean result 
)

Compare two process serial numbers.

You use SameProcess to compare two process serial numbers and to
determine whether they refer to the same process.
PSN1 is a pointer to a valid process serial number returned from
LaunchApplication , GetNextProcess , GetFrontProcess , or
GetCurrentProcess , or a high level event. You can also use the
constant kCurrentProcess to return to the current process.
PSN2 is a valid process serial number returned from
LaunchApplication , GetNextProcess , GetFrontProcess , or
GetCurrentProcess , or a high level event. You can also use the
constant kCurrentProcess to return to the current process.
result is a pointer to a Boolean value. If the process serial numbers
specified in the PSN1 and PSN2 parameters refer to the same
process, the SameProcess function returns TRUE in the result
parameter; otherwise, it returns FALSE in the result parameter.
Returns: an operating system Error Code .
noErr(0)No error
paramErr (-50)Process serial number is invalid
Note
When you compare two process serial numbers, use the SameProcess
function rather than any other means, because the interpretation of the bits
in a process serial number is internal to the Process Manager .
Copyright: THINK Reference © 1991-1992 Symantec Corporation
Non-Carbon CFM: in InterfaceLib 7.1 and later
Carbon Lib: in CarbonLib 1.0 and later
Mac OS X: in version 10.0 and later

◆ SetFrontProcess()

OSErr SetFrontProcess ( const ProcessSerialNumber PSN)

Make a process the foreground process.

You use the SetFrontProcess to schedule the specified process to become
the foreground process.
PSN is a pointer to a the process serial number of the process running in
the foreground
Returns: an operating system Error Code .
noErr(0)No error
procNotFound (-600)Process with specified process serial number does not
exist or process is suspended by high-level debugger
appIsDaemon (-606)Specified process is background-only
Note
The specified process becomes the foreground process after the current
foreground process makes a subsequent call to WaitNextEvent or
EventAvail .
The process serial number in the PSN parameter should be a valid process
serial number returned from LaunchApplication , GetNextProcess ,
SetFrontProcess , GetCurrentProcess , or a high-level event. You
can also use the constant kCurrentProcess to refer to the current process.
If the specified process serial number is invalid or if the specified process
is a background-only application, SetFrontProcess returns a nonzero
result code and does not change the current foreground process.
If a modal dialog box is the frontmost window, the specified process does
not become the foreground process until after the user dismisses the modal
dialog box.
Note: Do not call SetFrontProcess from a routine that executes
at interrupt time.
Copyright: THINK Reference © 1991-1992 Symantec Corporation
Non-Carbon CFM: in InterfaceLib 7.1 and later
Carbon Lib: in CarbonLib 1.0 and later
Mac OS X: in version 10.0 and later

◆ ShowHideProcess()

OSErr ShowHideProcess ( const ProcessSerialNumber psn,
Boolean  visible 
)

ShowHideProcess()

Summary: Hides or shows a given process.

Discussion: Given a psn, this call will hide or show the process specified in the psn parameter. You determine whether you would like to show or hide the process with the visible parameter. True passed into visible indicates you wish for the process to become visible.

Parameters:

psn: Serial number of the process

visible: true = show process; false = hide process

Non-Carbon CFM: not available
Carbon Lib: in CarbonLib 1.5 and later
Mac OS X: in version 10.1 and later

◆ WakeUpProcess()

OSErr WakeUpProcess ( const ProcessSerialNumber PSN)

Make a process eligible to receive CPU time.

You use the WakeUpProcess to makes a process suspended by
WaitNextEvent eligible to receive CPU time.
PSN is a pointer to the process serial number of the process designated to
receive CPU time.
Returns: an operating system Error Code .
noErr(0)No error
procNotFound (-600)Suspended process with specified process serial
number does not exist
Note
When a process specifies a nonzero value for the sleep parameter in the
WaitNextEvent function, and there are no events for that process
pending in the event queue, the process is suspended. This process remains
suspended until the time specified in the sleep parameter expires or an
event becomes available for that process. You can use WakeUpProcess to
make the process eligible for execution before the time specified in the sleep
parameter expires.
The WakeUpProcess function does not change the order of the processes
scheduled for execution; it only makes the specified process eligible for
execution.
The process serial number specified in the PSN parameter should be a
valid process serial number returned from LaunchApplication ,
GetNextProcess , GetFrontProcess , GetCurrentProcess , or a
high-level event.
Copyright: THINK Reference © 1991-1992 Symantec Corporation
Non-Carbon CFM: in InterfaceLib 7.1 and later
Carbon Lib: in CarbonLib 1.0 and later
Mac OS X: in version 10.0 and later