|
Mac OS 9
|
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 ProcessSerialNumber * | ProcessSerialNumberPtr |
| typedef unsigned short | LaunchFlags |
| typedef struct AppParameters | AppParameters |
| typedef AppParameters * | AppParametersPtr |
| typedef struct LaunchParamBlockRec | LaunchParamBlockRec |
| typedef LaunchParamBlockRec * | LaunchPBPtr |
| typedef struct ProcessInfoRec | ProcessInfoRec |
| typedef ProcessInfoRec * | ProcessInfoRecPtr |
| typedef struct ProcessInfoExtendedRec | ProcessInfoExtendedRec |
| typedef ProcessInfoExtendedRec * | ProcessInfoExtendedRecPtr |
| typedef struct SizeResourceRec | SizeResourceRec |
| typedef SizeResourceRec * | SizeResourceRecPtr |
| typedef SizeResourceRecPtr * | SizeResourceRecHandle |
| typedef short | item |
| typedef short short | numItems |
| typedef short short short | cPanelID |
| typedef short short short EventRecord * | theEvent |
| typedef short short short EventRecord long | cdevValue |
| typedef short short short EventRecord long DialogPtr | cpDialog |
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) |
Process Manager Interfaces.
For bug reports, consult the following page on the World Wide Web:
http://developer.apple.com/bugreporter/
| #define CallControlPanelDefProc | ( | userRoutine, | |
| message, | |||
| item, | |||
| numItems, | |||
| cPanelID, | |||
| theEvent, | |||
| cdevValue, | |||
| cpDialog | |||
| ) |
| #define InvokeControlPanelDefUPP | ( | message, | |
| item, | |||
| numItems, | |||
| cPanelID, | |||
| theEvent, | |||
| cdevValue, | |||
| cpDialog, | |||
| userUPP | |||
| ) |
| #define NewControlPanelDefUPP | ( | userRoutine | ) |
| 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.
| OSStatus CopyProcessName | ( | const ProcessSerialNumber * | psn, |
| CFStringRef * | name | ||
| ) |
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)
| void DisposeControlPanelDefUPP | ( | ControlPanelDefUPP | userUPP | ) |
| void ExitToShell | ( | void | ) |
| ScriptCode GetApplicationScript | ( | void | ) |
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.
| TextEncoding GetApplicationTextEncoding | ( | void | ) |
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.
| OSErr GetFrontProcess | ( | ProcessSerialNumber * | PSN | ) |
Get serial number of foreground process.
If no process is running in the foreground, GetFrontProcess returns the result code procNotFound.
| 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
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.
| OSStatus GetProcessBundleLocation | ( | const ProcessSerialNumber * | psn, |
| FSRef * | location | ||
| ) |
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
| OSErr GetProcessInformation | ( | const ProcessSerialNumber * | PSN, |
| ProcessInfoRec * | info | ||
| ) |
| long InvokeControlPanelDefUPP | ( | short | message, |
| short | item, | ||
| short | numItems, | ||
| short | cPanelID, | ||
| EventRecord * | theEvent, | ||
| long | cdevValue, | ||
| DialogPtr | cpDialog, | ||
| ControlPanelDefUPP | userUPP | ||
| ) |
| Boolean IsProcessVisible | ( | const ProcessSerialNumber * | psn | ) |
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
| OSErr LaunchApplication | ( | LaunchPBPtr | LaunchParams | ) |
| 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()
| OSErr LaunchDeskAccessory | ( | const FSSpec * | pFileSpec, |
| ConstStr255Param | pDAName | ||
| ) |
| OSErr MacGetCurrentProcess | ( | ProcessSerialNumber * | PSN | ) |
[Mac]GetCurrentProcess()
| ControlPanelDefUPP NewControlPanelDefUPP | ( | ControlPanelDefProcPtr | userRoutine | ) |
| 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
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 .
| 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
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.
| OSErr ShowHideProcess | ( | const ProcessSerialNumber * | psn, |
| Boolean | visible | ||
| ) |
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
| 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
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.