Processes.pas 39 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188
  1. {
  2. File: HIServices/Processes.h
  3. Contains: Process Manager Interfaces.
  4. Version: HIServices-416~44
  5. Copyright: © 1989-2008 by Apple Computer, Inc., all rights reserved
  6. Bugs?: For bug reports, consult the following page on
  7. the World Wide Web:
  8. http://bugs.freepascal.org
  9. }
  10. { Pascal Translation Updated: Peter N Lewis, <[email protected]>, August 2005 }
  11. { Pascal Translation Updated: Jonas Maebe, <[email protected]>, October 2009 }
  12. { Pascal Translation Updated: Jonas Maebe, <[email protected]>, October 2012 }
  13. {
  14. Modified for use with Free Pascal
  15. Version 308
  16. Please report any bugs to <[email protected]>
  17. }
  18. {$ifc not defined MACOSALLINCLUDE or not MACOSALLINCLUDE}
  19. {$mode macpas}
  20. {$modeswitch cblocks}
  21. {$packenum 1}
  22. {$macro on}
  23. {$inline on}
  24. {$calling mwpascal}
  25. {$IFNDEF FPC_DOTTEDUNITS}
  26. unit Processes;
  27. {$ENDIF FPC_DOTTEDUNITS}
  28. interface
  29. {$setc UNIVERSAL_INTERFACES_VERSION := $0400}
  30. {$setc GAP_INTERFACES_VERSION := $0308}
  31. {$ifc not defined USE_CFSTR_CONSTANT_MACROS}
  32. {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
  33. {$endc}
  34. {$ifc defined CPUPOWERPC and defined CPUI386}
  35. {$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
  36. {$endc}
  37. {$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
  38. {$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
  39. {$endc}
  40. {$ifc not defined __ppc__ and defined CPUPOWERPC32}
  41. {$setc __ppc__ := 1}
  42. {$elsec}
  43. {$setc __ppc__ := 0}
  44. {$endc}
  45. {$ifc not defined __ppc64__ and defined CPUPOWERPC64}
  46. {$setc __ppc64__ := 1}
  47. {$elsec}
  48. {$setc __ppc64__ := 0}
  49. {$endc}
  50. {$ifc not defined __i386__ and defined CPUI386}
  51. {$setc __i386__ := 1}
  52. {$elsec}
  53. {$setc __i386__ := 0}
  54. {$endc}
  55. {$ifc not defined __x86_64__ and defined CPUX86_64}
  56. {$setc __x86_64__ := 1}
  57. {$elsec}
  58. {$setc __x86_64__ := 0}
  59. {$endc}
  60. {$ifc not defined __arm__ and defined CPUARM}
  61. {$setc __arm__ := 1}
  62. {$elsec}
  63. {$setc __arm__ := 0}
  64. {$endc}
  65. {$ifc not defined __arm64__ and defined CPUAARCH64}
  66. {$setc __arm64__ := 1}
  67. {$elsec}
  68. {$setc __arm64__ := 0}
  69. {$endc}
  70. {$ifc defined cpu64}
  71. {$setc __LP64__ := 1}
  72. {$elsec}
  73. {$setc __LP64__ := 0}
  74. {$endc}
  75. {$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
  76. {$error Conflicting definitions for __ppc__ and __i386__}
  77. {$endc}
  78. {$ifc defined __ppc__ and __ppc__}
  79. {$setc TARGET_CPU_PPC := TRUE}
  80. {$setc TARGET_CPU_PPC64 := FALSE}
  81. {$setc TARGET_CPU_X86 := FALSE}
  82. {$setc TARGET_CPU_X86_64 := FALSE}
  83. {$setc TARGET_CPU_ARM := FALSE}
  84. {$setc TARGET_CPU_ARM64 := FALSE}
  85. {$setc TARGET_OS_MAC := TRUE}
  86. {$setc TARGET_OS_IPHONE := FALSE}
  87. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  88. {$setc TARGET_OS_EMBEDDED := FALSE}
  89. {$elifc defined __ppc64__ and __ppc64__}
  90. {$setc TARGET_CPU_PPC := FALSE}
  91. {$setc TARGET_CPU_PPC64 := TRUE}
  92. {$setc TARGET_CPU_X86 := FALSE}
  93. {$setc TARGET_CPU_X86_64 := FALSE}
  94. {$setc TARGET_CPU_ARM := FALSE}
  95. {$setc TARGET_CPU_ARM64 := FALSE}
  96. {$setc TARGET_OS_MAC := TRUE}
  97. {$setc TARGET_OS_IPHONE := FALSE}
  98. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  99. {$setc TARGET_OS_EMBEDDED := FALSE}
  100. {$elifc defined __i386__ and __i386__}
  101. {$setc TARGET_CPU_PPC := FALSE}
  102. {$setc TARGET_CPU_PPC64 := FALSE}
  103. {$setc TARGET_CPU_X86 := TRUE}
  104. {$setc TARGET_CPU_X86_64 := FALSE}
  105. {$setc TARGET_CPU_ARM := FALSE}
  106. {$setc TARGET_CPU_ARM64 := FALSE}
  107. {$ifc defined iphonesim}
  108. {$setc TARGET_OS_MAC := FALSE}
  109. {$setc TARGET_OS_IPHONE := TRUE}
  110. {$setc TARGET_IPHONE_SIMULATOR := TRUE}
  111. {$elsec}
  112. {$setc TARGET_OS_MAC := TRUE}
  113. {$setc TARGET_OS_IPHONE := FALSE}
  114. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  115. {$endc}
  116. {$setc TARGET_OS_EMBEDDED := FALSE}
  117. {$elifc defined __x86_64__ and __x86_64__}
  118. {$setc TARGET_CPU_PPC := FALSE}
  119. {$setc TARGET_CPU_PPC64 := FALSE}
  120. {$setc TARGET_CPU_X86 := FALSE}
  121. {$setc TARGET_CPU_X86_64 := TRUE}
  122. {$setc TARGET_CPU_ARM := FALSE}
  123. {$setc TARGET_CPU_ARM64 := FALSE}
  124. {$ifc defined iphonesim}
  125. {$setc TARGET_OS_MAC := FALSE}
  126. {$setc TARGET_OS_IPHONE := TRUE}
  127. {$setc TARGET_IPHONE_SIMULATOR := TRUE}
  128. {$elsec}
  129. {$setc TARGET_OS_MAC := TRUE}
  130. {$setc TARGET_OS_IPHONE := FALSE}
  131. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  132. {$endc}
  133. {$setc TARGET_OS_EMBEDDED := FALSE}
  134. {$elifc defined __arm__ and __arm__}
  135. {$setc TARGET_CPU_PPC := FALSE}
  136. {$setc TARGET_CPU_PPC64 := FALSE}
  137. {$setc TARGET_CPU_X86 := FALSE}
  138. {$setc TARGET_CPU_X86_64 := FALSE}
  139. {$setc TARGET_CPU_ARM := TRUE}
  140. {$setc TARGET_CPU_ARM64 := FALSE}
  141. {$setc TARGET_OS_MAC := FALSE}
  142. {$setc TARGET_OS_IPHONE := TRUE}
  143. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  144. {$setc TARGET_OS_EMBEDDED := TRUE}
  145. {$elifc defined __arm64__ and __arm64__}
  146. {$setc TARGET_CPU_PPC := FALSE}
  147. {$setc TARGET_CPU_PPC64 := FALSE}
  148. {$setc TARGET_CPU_X86 := FALSE}
  149. {$setc TARGET_CPU_X86_64 := FALSE}
  150. {$setc TARGET_CPU_ARM := FALSE}
  151. {$setc TARGET_CPU_ARM64 := TRUE}
  152. {$ifc defined ios}
  153. {$setc TARGET_OS_MAC := FALSE}
  154. {$setc TARGET_OS_IPHONE := TRUE}
  155. {$setc TARGET_OS_EMBEDDED := TRUE}
  156. {$elsec}
  157. {$setc TARGET_OS_MAC := TRUE}
  158. {$setc TARGET_OS_IPHONE := FALSE}
  159. {$setc TARGET_OS_EMBEDDED := FALSE}
  160. {$endc}
  161. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  162. {$elsec}
  163. {$error __ppc__ nor __ppc64__ nor __i386__ nor __x86_64__ nor __arm__ nor __arm64__ is defined.}
  164. {$endc}
  165. {$ifc defined __LP64__ and __LP64__ }
  166. {$setc TARGET_CPU_64 := TRUE}
  167. {$elsec}
  168. {$setc TARGET_CPU_64 := FALSE}
  169. {$endc}
  170. {$ifc defined FPC_BIG_ENDIAN}
  171. {$setc TARGET_RT_BIG_ENDIAN := TRUE}
  172. {$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
  173. {$elifc defined FPC_LITTLE_ENDIAN}
  174. {$setc TARGET_RT_BIG_ENDIAN := FALSE}
  175. {$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
  176. {$elsec}
  177. {$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
  178. {$endc}
  179. {$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
  180. {$setc CALL_NOT_IN_CARBON := FALSE}
  181. {$setc OLDROUTINENAMES := FALSE}
  182. {$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
  183. {$setc OPAQUE_UPP_TYPES := TRUE}
  184. {$setc OTCARBONAPPLICATION := TRUE}
  185. {$setc OTKERNEL := FALSE}
  186. {$setc PM_USE_SESSION_APIS := TRUE}
  187. {$setc TARGET_API_MAC_CARBON := TRUE}
  188. {$setc TARGET_API_MAC_OS8 := FALSE}
  189. {$setc TARGET_API_MAC_OSX := TRUE}
  190. {$setc TARGET_CARBON := TRUE}
  191. {$setc TARGET_CPU_68K := FALSE}
  192. {$setc TARGET_CPU_MIPS := FALSE}
  193. {$setc TARGET_CPU_SPARC := FALSE}
  194. {$setc TARGET_OS_UNIX := FALSE}
  195. {$setc TARGET_OS_WIN32 := FALSE}
  196. {$setc TARGET_RT_MAC_68881 := FALSE}
  197. {$setc TARGET_RT_MAC_CFM := FALSE}
  198. {$setc TARGET_RT_MAC_MACHO := TRUE}
  199. {$setc TYPED_FUNCTION_POINTERS := TRUE}
  200. {$setc TYPE_BOOL := FALSE}
  201. {$setc TYPE_EXTENDED := FALSE}
  202. {$setc TYPE_LONGLONG := TRUE}
  203. {$IFDEF FPC_DOTTEDUNITS}
  204. uses MacOsApi.MacTypes,MacOsApi.CFBase,MacOsApi.CFDictionary,MacOsApi.Events,MacOsApi.Files,MacOsApi.MacOSXPosix;
  205. {$ELSE FPC_DOTTEDUNITS}
  206. uses MacTypes,CFBase,CFDictionary,Events,Files,MacOSXPosix;
  207. {$ENDIF FPC_DOTTEDUNITS}
  208. {$endc} {not MACOSALLINCLUDE}
  209. {$ifc TARGET_OS_MAC}
  210. {$ALIGN MAC68K}
  211. const
  212. { Process identifier - Various reserved process serial numbers }
  213. kNoProcess = 0;
  214. kSystemProcess = 1;
  215. kCurrentProcess = 2;
  216. { Definition of the parameter block passed to _Launch }
  217. { Typedef and flags for launchControlFlags field}
  218. type
  219. LaunchFlags = UInt16;
  220. const
  221. launchContinue = $4000;
  222. launchNoFileFlags = $0800;
  223. launchUseMinimum = $0400;
  224. launchDontSwitch = $0200;
  225. launchAllow24Bit = $0100;
  226. launchInhibitDaemon = $0080;
  227. { Format for first AppleEvent to pass to new process. The size of the overall
  228. buffer variable: the message body immediately follows the messageLength }
  229. type
  230. AppParameters = record
  231. theMsgEvent: EventRecord;
  232. eventRefCon: UInt32;
  233. messageLength: UInt32;
  234. end;
  235. AppParametersPtr = ^AppParameters;
  236. { Parameter block to _Launch }
  237. {$ifc TARGET_CPU_64}
  238. type
  239. LaunchParamBlockRec = record
  240. reserved1: UInt32;
  241. reserved2: UInt16;
  242. launchBlockID: UInt16;
  243. launchEPBLength: UInt32;
  244. launchFileFlags: UInt16;
  245. launchControlFlags: LaunchFlags;
  246. launchAppRef: FSRefPtr;
  247. launchProcessSN: ProcessSerialNumber;
  248. launchPreferredSize: UInt32;
  249. launchMinimumSize: UInt32;
  250. launchAvailableSize: UInt32;
  251. launchAppParameters: AppParametersPtr;
  252. end;
  253. {$elsec}
  254. type
  255. LaunchParamBlockRec = record
  256. reserved1: UInt32;
  257. reserved2: UInt16;
  258. launchBlockID: UInt16;
  259. launchEPBLength: UInt32;
  260. launchFileFlags: UInt16;
  261. launchControlFlags: LaunchFlags;
  262. launchAppSpec: FSSpecPtr;
  263. launchProcessSN: ProcessSerialNumber;
  264. launchPreferredSize: UInt32;
  265. launchMinimumSize: UInt32;
  266. launchAvailableSize: UInt32;
  267. launchAppParameters: AppParametersPtr;
  268. end;
  269. {$endc} {TARGET_CPU_64}
  270. LaunchParamBlockRecPtr = ^LaunchParamBlockRec;
  271. type
  272. LaunchPBPtr = LaunchParamBlockRecPtr;
  273. { Set launchBlockID to extendedBlock to specify that extensions exist.
  274. Set launchEPBLength to extendedBlockLen for compatibility.}
  275. const
  276. extendedBlock = $4C43; { 'LC' }
  277. extendedBlockLen = SizeOf(LaunchParamBlockRec) - 12;
  278. const
  279. { Definition of the information block returned by GetProcessInformation }
  280. modeReserved = $01000000;
  281. modeControlPanel = $00080000;
  282. modeLaunchDontSwitch = $00040000;
  283. modeDeskAccessory = $00020000;
  284. modeMultiLaunch = $00010000;
  285. modeNeedSuspendResume = $00004000;
  286. modeCanBackground = $00001000;
  287. modeDoesActivateOnFGSwitch = $00000800;
  288. modeOnlyBackground = $00000400;
  289. modeGetFrontClicks = $00000200;
  290. modeGetAppDiedMsg = $00000100;
  291. mode32BitCompatible = $00000080;
  292. modeHighLevelEventAware = $00000040;
  293. modeLocalAndRemoteHLEvents = $00000020;
  294. modeStationeryAware = $00000010;
  295. modeUseTextEditServices = $00000008;
  296. modeDisplayManagerAware = $00000004;
  297. type
  298. ProcessApplicationTransformState = UInt32;
  299. const
  300. kProcessTransformToForegroundApplication = 1;
  301. kProcessTransformToBackgroundApplication = 2; { functional in Mac OS X Barolo and later }
  302. kProcessTransformToUIElementApplication = 4; { functional in Mac OS X Barolo and later }
  303. {
  304. Record returned by GetProcessInformation
  305. When calling GetProcessInformation(), the input ProcessInfoRec
  306. should have the processInfoLength set to sizeof(ProcessInfoRec),
  307. the processName field set to nil or a pointer to a Str255, and
  308. processAppSpec set to nil or a pointer to an FSSpec. If
  309. processName or processAppSpec are not specified, this routine
  310. will very likely write data to whatever random location in memory
  311. these happen to point to, which is not a good thing.
  312. Note: The processName field may not be what you expect, especially if
  313. an application has a localized name. The .processName field, if not NULL,
  314. on return will contain the filename part of the executable file of the
  315. application. If you want the localized, user-displayable name for an
  316. application, call CopyProcessName().
  317. On Mac OS X, some flags in processMode will not be set as they were on
  318. Mac OS 9, even for Classic applications. Mac OS X doesn't support
  319. applications which can't be sent into the background, so
  320. modeCanBackground will always be set. Similarly, Mac OS X applications
  321. will always have mode32BitCompatible and modeHighLevelEventAware
  322. set.
  323. }
  324. {$ifc TARGET_CPU_64}
  325. type
  326. ProcessInfoRec = record
  327. processInfoLength: UInt32;
  328. processName: StringPtr;
  329. processNumber: ProcessSerialNumber;
  330. processType: UInt32;
  331. processSignature: OSType;
  332. processMode: UInt32;
  333. processLocation: Ptr;
  334. processSize: UInt32;
  335. processFreeMem: UInt32;
  336. processLauncher: ProcessSerialNumber;
  337. processLaunchDate: UInt32;
  338. processActiveTime: UInt32;
  339. processAppRef: FSRefPtr;
  340. end;
  341. {$elsec}
  342. type
  343. ProcessInfoRec = record
  344. processInfoLength: UInt32;
  345. processName: StringPtr;
  346. processNumber: ProcessSerialNumber;
  347. processType: UInt32;
  348. processSignature: OSType;
  349. processMode: UInt32;
  350. processLocation: Ptr;
  351. processSize: UInt32;
  352. processFreeMem: UInt32;
  353. processLauncher: ProcessSerialNumber;
  354. processLaunchDate: UInt32;
  355. processActiveTime: UInt32;
  356. processAppSpec: FSSpecPtr;
  357. end;
  358. {$endc} {TARGET_CPU_64}
  359. ProcessInfoRecPtr = ^ProcessInfoRec;
  360. {
  361. Some applications assumed the size of a ProcessInfoRec would never change,
  362. which has caused problems trying to return additional information. In
  363. the future, we will add fields to ProcessInfoExtendedRec when necessary,
  364. and callers which wish to access 'more' data than originally was present
  365. in ProcessInfoRec should allocate space for a ProcessInfoExtendedRec,
  366. fill in the processInfoLength ( and processName and processAppSpec ptrs ),
  367. then coerce this to a ProcessInfoRecPtr in the call to
  368. GetProcessInformation().
  369. Note: The processName field may not be what you expect, especially if
  370. an application has a localized name. The .processName field, if not NULL,
  371. on return will contain the filename part of the executable file of the
  372. application. If you want the localized, user-displayable name for an
  373. application, call CopyProcessName().
  374. On Mac OS X, some flags in processMode will not be set as they were on
  375. Mac OS 9, even for Classic applications. Mac OS X doesn't support
  376. applications which can't be sent into the background, so
  377. modeCanBackground will always be set. Similarly, Mac OS X applications
  378. will always have mode32BitCompatible and modeHighLevelEventAware
  379. set.
  380. }
  381. {$ifc TARGET_CPU_64}
  382. type
  383. ProcessInfoExtendedRec = record
  384. processInfoLength: UInt32;
  385. processName: StringPtr;
  386. processNumber: ProcessSerialNumber;
  387. processType: UInt32;
  388. processSignature: OSType;
  389. processMode: UInt32;
  390. processLocation: Ptr;
  391. processSize: UInt32;
  392. processFreeMem: UInt32;
  393. processLauncher: ProcessSerialNumber;
  394. processLaunchDate: UInt32;
  395. processActiveTime: UInt32;
  396. processAppRef: FSRefPtr;
  397. processTempMemTotal: UInt32;
  398. processPurgeableTempMemTotal: UInt32;
  399. end;
  400. {$elsec}
  401. type
  402. ProcessInfoExtendedRec = record
  403. processInfoLength: UInt32;
  404. processName: StringPtr;
  405. processNumber: ProcessSerialNumber;
  406. processType: UInt32;
  407. processSignature: OSType;
  408. processMode: UInt32;
  409. processLocation: Ptr;
  410. processSize: UInt32;
  411. processFreeMem: UInt32;
  412. processLauncher: ProcessSerialNumber;
  413. processLaunchDate: UInt32;
  414. processActiveTime: UInt32;
  415. processAppSpec: FSSpecPtr;
  416. processTempMemTotal: UInt32;
  417. processPurgeableTempMemTotal: UInt32;
  418. end;
  419. {$endc} {TARGET_CPU_64}
  420. ProcessInfoExtendedRecPtr = ^ProcessInfoExtendedRec;
  421. { Record corresponding to the SIZE resource definition }
  422. type
  423. SizeResourceRec = record
  424. flags: UInt16;
  425. preferredHeapSize: UInt32;
  426. minimumHeapSize: UInt32;
  427. end;
  428. SizeResourceRecPtr = ^SizeResourceRec;
  429. type
  430. SizeResourceRecHandle = ^SizeResourceRecPtr;
  431. {
  432. * Summary:
  433. * Options for ProcessInformationCopyDictionary
  434. }
  435. const
  436. {
  437. * Return all information known about the application in the
  438. * dictionary.
  439. }
  440. kProcessDictionaryIncludeAllInformationMask = $FFFFFFFF;
  441. {
  442. Applications and background applications can control when they are asked to quit
  443. by the system at restart/shutdown by setting these bits in a 'quit' ( 0 ) resource
  444. in their application's resource fork. Applications without a 'quit' ( 0 ) will
  445. be quit at kQuitAtNormalTime mask.
  446. These options only function on Mac OS 9.x at this time.
  447. }
  448. const
  449. kQuitBeforeNormalTimeMask = 1;
  450. kQuitAtNormalTimeMask = 2;
  451. kQuitBeforeFBAsQuitMask = 4;
  452. kQuitBeforeShellQuitsMask = 8;
  453. kQuitBeforeTerminatorAppQuitsMask = 16;
  454. kQuitNeverMask = 32;
  455. kQuitOptionsMask = $7F;
  456. kQuitNotQuitDuringInstallMask = $0100;
  457. kQuitNotQuitDuringLogoutMask = $0200;
  458. {
  459. * LaunchApplication()
  460. *
  461. * Mac OS X threading:
  462. * Thread safe since version 10.3
  463. *
  464. * Availability:
  465. * Mac OS X: in version 10.0 and later in ApplicationServices.framework
  466. * CarbonLib: in CarbonLib 1.0 and later
  467. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  468. }
  469. function LaunchApplication( LaunchParams: LaunchPBPtr ): OSErr; external name '_LaunchApplication';
  470. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  471. {$ifc not TARGET_CPU_64}
  472. {
  473. * LaunchDeskAccessory()
  474. *
  475. * Availability:
  476. * Mac OS X: not available [32-bit only]
  477. * CarbonLib: not available
  478. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  479. }
  480. {$endc} {not TARGET_CPU_64}
  481. {
  482. * [Mac]GetCurrentProcess()
  483. *
  484. * Discussion:
  485. * Return the canonical process serial number to the caller.
  486. *
  487. * All applications ( things which can appear in the Dock or which
  488. * are not documents and are launched by the Finder or Dock ) on Mac
  489. * OS 10 have a unique process serial number. This number is created
  490. * when the application launches, and remains until the application
  491. * quits. Other system services, like AppleEvents, use the
  492. * ProcessSerialNumber to specify an application.
  493. *
  494. * During launch, every application 'checks in' with the Process
  495. * Manager. Before this checkin, the application can not receive
  496. * events or draw to the screen. Prior to Mac OS 10.2, this 'check
  497. * in' happened before the applications's main() function was
  498. * entered. In Mac OS 10.2 and later, this 'check in' does not
  499. * happen until the first time the application calls a Process
  500. * Manager function, or until it enters CFRunLoopRun() for the main
  501. * runloop. This allows tools and other executables which do not
  502. * need to receive events to link against more of the higher level
  503. * toolbox frameworks, but may cause a problem if the application
  504. * expects to be able to retrieve events or use CoreGraphics
  505. * services before this checkin has occurred.
  506. *
  507. * An application can force the connection to the Process Manager to
  508. * be set up by calling any Process Manager routine, but the
  509. * recommended way to do this is to call GetCurrentProcess() to ask
  510. * for the current application's PSN. This will initialize the
  511. * connection to the Process Manager if it has not already been set
  512. * up and 'check in' the application with the system.
  513. *
  514. * This function is named MacGetCurrentProcess() on non Macintosh
  515. * platforms and GetCurrentProcess on the Macintosh. However, even
  516. * Macintosh code can use the MacGetCurrentProcess() name since
  517. * there is a macro which maps back to GetCurrentProcess().
  518. *
  519. * Lastly, it is usually not necessary to call GetCurrentProcess()
  520. * to get the 'current' process psn merely to pass it to another
  521. * Process Manager routine. Instead, just construct a
  522. * ProcessSerialNumber with 0 in highLongOfPSN and kCurrentProcess
  523. * in lowLongOfPSN and pass that. For example, to make the current
  524. * process the frontmost process, use ( C code follows )
  525. *
  526. * ProcessSerialNumber psn = ( 0, kCurrentProcess );
  527. *
  528. * OSErr err = SetFrontProcess( & psn );
  529. *
  530. * If you need to pass a ProcessSerialNumber to another application
  531. * or use it in an AppleEvent, you do need to get the canonical PSN
  532. * with this routine.
  533. *
  534. * Mac OS X threading:
  535. * Thread safe since version 10.3
  536. *
  537. * Parameters:
  538. *
  539. * PSN:
  540. * Pass in where the current application process serial number
  541. * should be returned.
  542. *
  543. * Result:
  544. * An operating system status code.
  545. *
  546. * Availability:
  547. * Mac OS X: in version 10.0 and later in ApplicationServices.framework
  548. * CarbonLib: in CarbonLib 1.0 and later
  549. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  550. }
  551. {$ifc TARGET_OS_MAC}
  552. function MacGetCurrentProcess( var PSN: ProcessSerialNumber ): OSErr; external name '_GetCurrentProcess';
  553. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  554. {$endc} {TARGET_OS_MAC}
  555. function GetCurrentProcess( var PSN: ProcessSerialNumber ): OSErr; external name '_GetCurrentProcess';
  556. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  557. {
  558. * GetFrontProcess()
  559. *
  560. * Mac OS X threading:
  561. * Thread safe since version 10.3
  562. *
  563. * Availability:
  564. * Mac OS X: in version 10.0 and later in ApplicationServices.framework
  565. * CarbonLib: in CarbonLib 1.0 and later
  566. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  567. }
  568. function GetFrontProcess( var PSN: ProcessSerialNumber ): OSErr; external name '_GetFrontProcess';
  569. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  570. {
  571. * GetNextProcess()
  572. *
  573. * Mac OS X threading:
  574. * Thread safe since version 10.3
  575. *
  576. * Availability:
  577. * Mac OS X: in version 10.0 and later in ApplicationServices.framework
  578. * CarbonLib: in CarbonLib 1.0 and later
  579. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  580. }
  581. function GetNextProcess( var PSN: ProcessSerialNumber ): OSErr; external name '_GetNextProcess';
  582. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  583. {
  584. * GetProcessInformation()
  585. *
  586. * Discussion:
  587. * Fill in the provided record with information about the process
  588. * with the provided process serial number.
  589. *
  590. * The caller must fill in the .processInfoLength field with the
  591. * value sizeof ( ProcessInformationRecord ) before making this
  592. * call. Also, the .processName field must point to either NULL or
  593. * to a Str31 structure in the caller's memory space, and the
  594. * .processAppSpec field must point to a FSSpec in the caller's
  595. * memory space.
  596. *
  597. * If the caller does not care about the process name or the process
  598. * application spec values, then setting those fields in the
  599. * structure to NULL before this call means less work must be done
  600. * to construct these values and so the call is more
  601. * efficient.
  602. *
  603. * The processName field may not be what you expect, especially if
  604. * an application has a localized name. The .processName field, if
  605. * not NULL, on return will contain the filename part of the
  606. * executable file of the application. If you want the localized,
  607. * user-displayable name for an application, call
  608. * CopyProcessName().
  609. *
  610. * On Mac OS X, the processSize and processFreeMem fields are
  611. * returned with the value 0.
  612. *
  613. * On Mac OS X 10.6 and later, the processLaunchDate field is an
  614. * integer value with the same scale as CFAbsoluteTime. Prior
  615. * releases used a value in 60th of a second with a random zero
  616. * time, making it difficult to use. Since most applications just
  617. * look at the comparison from this field to other launch dates this
  618. * change should not affect many applications.
  619. *
  620. * Mac OS X threading:
  621. * Thread safe since version 10.3
  622. *
  623. * Parameters:
  624. *
  625. * PSN:
  626. * Pass in the process serial number of the process to return
  627. * information for.
  628. *
  629. * info:
  630. * Pass in a structure where the information will be returned.
  631. *
  632. * Availability:
  633. * Mac OS X: in version 10.0 and later in ApplicationServices.framework
  634. * CarbonLib: in CarbonLib 1.0 and later
  635. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  636. }
  637. function GetProcessInformation( const (*var*) PSN: ProcessSerialNumber; var info: ProcessInfoRec ): OSErr; external name '_GetProcessInformation';
  638. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  639. {
  640. * ProcessInformationCopyDictionary()
  641. *
  642. * Discussion:
  643. * Return a CFDictionary containing information about the given
  644. * process. This is intended to return a superset of the information
  645. * returned by GetProcessInformation(), in more modern datatypes.
  646. *
  647. * Mac OS X threading:
  648. * Thread safe since version 10.3
  649. *
  650. * Parameters:
  651. *
  652. * PSN:
  653. * Pass in the process serial number of the process to return
  654. * information for.
  655. *
  656. * infoToReturn:
  657. * Pass in the value kProcessDictionaryIncludeAllInformationMask.
  658. *
  659. * Result:
  660. * An immutable CFDictionaryRef containing these keys and their
  661. * values. Keys marked with a '*' are optional. Over time more keys
  662. * may be added.
  663. *
  664. * Key Name Type
  665. * -------- ----
  666. * "PSN" CFNumber, kCFNumberLongLongType
  667. * "Flavor" CFNumber, kCFNumberSInt32. A hint
  668. * as to the flavor of the application. Note that this should only
  669. * be used as a hint, since a bundle of a different flavor might be
  670. * loaded into an application's address space. The assigned values
  671. * at present are: Mac OS Classic aplications have the value 0,
  672. * Carbon applications have the value 2, Cocoa applications have the
  673. * value 3. Other undocumented values may also be returned.
  674. * "Attributes" CFNumber, kCFNumberSInt32
  675. * "ParentPSN" * CFNumber, kCFNumberLongLong
  676. * "FileType" * CFString, file type
  677. * "FileCreator" * CFString, file creator
  678. * "pid" * CFNumber, kCFNumberLongType
  679. * "LSBackgroundOnly" CFBoolean
  680. * "LSUIElement" CFBoolean
  681. * "IsHiddenAttr" CFBoolean
  682. * "IsCheckedInAttr" CFBoolean
  683. * "RequiresCarbon" CFBoolean
  684. * "LSUserQuitOnly" * CFBoolean
  685. * "LSUIPresentationMode" CFNumber, kCFNumberShortType
  686. * "BundlePath" * CFString
  687. * kCFBundleExecutableKey * CFString
  688. * kCFBundleNameKey * CFString
  689. * kCFBundleIdentifierKey * CFString
  690. *
  691. * Availability:
  692. * Mac OS X: in version 10.2 and later in ApplicationServices.framework
  693. * CarbonLib: not available in CarbonLib 1.x
  694. * Non-Carbon CFM: not available
  695. }
  696. function ProcessInformationCopyDictionary( const (*var*) PSN: ProcessSerialNumber; infoToReturn: UInt32 ): CFDictionaryRef; external name '_ProcessInformationCopyDictionary';
  697. (* AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER *)
  698. {
  699. * SetFrontProcess()
  700. *
  701. * Mac OS X threading:
  702. * Thread safe since version 10.3
  703. *
  704. * Availability:
  705. * Mac OS X: in version 10.0 and later in ApplicationServices.framework
  706. * CarbonLib: in CarbonLib 1.0 and later
  707. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  708. }
  709. function SetFrontProcess( const (*var*) PSN: ProcessSerialNumber ): OSErr; external name '_SetFrontProcess';
  710. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  711. {
  712. * Summary:
  713. * Options for SetFrontProcessWithOptions
  714. }
  715. const
  716. {
  717. * Activate the process, but bring only the frontmost non-floating
  718. * window forward. If this option is not set, all process windows are
  719. * brought forward.
  720. }
  721. kSetFrontProcessFrontWindowOnly = 1 shl 0;
  722. kSetFrontProcessCausedByUser = 1 shl 1; { indicates that direct user activity is causing this SetFrontProcessWithOptions() call }
  723. {
  724. * SetFrontProcessWithOptions()
  725. *
  726. * Discussion:
  727. * Brings a process to the front of the process list and activates
  728. * it. This is much like the SetFrontProcess API, though we allow
  729. * more control here. Passing 0 for the options is equivalent to
  730. * calling SetFrontProcess. Alternatively, you can pass
  731. * kSetFrontProcessFrontWindowOnly, which will activate a process
  732. * without bringing all of the process's windows forward (just the
  733. * front window of the process will come forward).
  734. *
  735. * Mac OS X threading:
  736. * Thread safe since version 10.3
  737. *
  738. * Parameters:
  739. *
  740. * inProcess:
  741. * The process to make frontmost.
  742. *
  743. * inOptions:
  744. * Any options you wish to specify.
  745. *
  746. * Result:
  747. * An operating system status code.
  748. *
  749. * Availability:
  750. * Mac OS X: in version 10.2 and later in ApplicationServices.framework
  751. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  752. * Non-Carbon CFM: not available
  753. }
  754. function SetFrontProcessWithOptions( const (*var*) inProcess: ProcessSerialNumber; inOptions: OptionBits ): OSStatus; external name '_SetFrontProcessWithOptions';
  755. (* AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER *)
  756. {
  757. * WakeUpProcess()
  758. *
  759. * Mac OS X threading:
  760. * Thread safe since version 10.3
  761. *
  762. * Availability:
  763. * Mac OS X: in version 10.0 and later in ApplicationServices.framework
  764. * CarbonLib: in CarbonLib 1.0 and later
  765. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  766. }
  767. function WakeUpProcess( const (*var*) PSN: ProcessSerialNumber ): OSErr; external name '_WakeUpProcess';
  768. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  769. {
  770. * SameProcess()
  771. *
  772. * Mac OS X threading:
  773. * Thread safe since version 10.3
  774. *
  775. * Availability:
  776. * Mac OS X: in version 10.0 and later in ApplicationServices.framework
  777. * CarbonLib: in CarbonLib 1.0 and later
  778. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  779. }
  780. function SameProcess( const (*var*) PSN1: ProcessSerialNumber; const (*var*) PSN2: ProcessSerialNumber; var result: Boolean ): OSErr; external name '_SameProcess';
  781. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  782. { ExitToShell was previously in SegLoad.h}
  783. {
  784. * ExitToShell()
  785. *
  786. * Discussion:
  787. * In general, you need to call ExitToShell only if you want your
  788. * application to terminate without reaching the end of its main
  789. * function.
  790. *
  791. * The ExitToShell function terminates the calling process. The
  792. * Process Manager removes your application from the list of open
  793. * processes and performs any other necessary cleanup operations. If
  794. * necessary, the Application Died Apple event is sent to the
  795. * process that launched your application.
  796. *
  797. * Availability:
  798. * Mac OS X: in version 10.0 and later in ApplicationServices.framework
  799. * CarbonLib: in CarbonLib 1.0 and later
  800. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  801. }
  802. procedure ExitToShell; external name '_ExitToShell';
  803. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  804. {
  805. * KillProcess()
  806. *
  807. * Discussion:
  808. * Kills the process with the given process serial number, without
  809. * sending it a 'quit' AppleEvent or otherwise allowing it to save
  810. * user data or clean up. This should be a last resort way to 'kill'
  811. * an application, after all other attempts to make it stop have
  812. * failed. It is not guaranteed that this will succeed and that the
  813. * target application will be killed, even if this function returns
  814. * noErr and seems to work.
  815. *
  816. * Mac OS X threading:
  817. * Thread safe since version 10.3
  818. *
  819. * Parameters:
  820. *
  821. * inProcess:
  822. * The process to kill.
  823. *
  824. * Result:
  825. * An operating system status code.
  826. *
  827. * Availability:
  828. * Mac OS X: in version 10.2 and later in ApplicationServices.framework
  829. * CarbonLib: not available in CarbonLib 1.x
  830. * Non-Carbon CFM: not available
  831. }
  832. function KillProcess( const (*var*) inProcess: ProcessSerialNumber ): OSErr; external name '_KillProcess';
  833. (* AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER *)
  834. {
  835. LaunchControlPanel is similar to LaunchDeskAccessory, but for Control Panel files instead.
  836. It launches a control panel in an application shell maintained by the Process Manager.
  837. }
  838. {$ifc not TARGET_CPU_64}
  839. {
  840. * LaunchControlPanel()
  841. *
  842. * Availability:
  843. * Mac OS X: not available [32-bit only]
  844. * CarbonLib: not available
  845. * Non-Carbon CFM: in InterfaceLib 9.0 and later
  846. }
  847. {$endc} {not TARGET_CPU_64}
  848. {
  849. * GetProcessBundleLocation()
  850. *
  851. * Summary:
  852. * Retrieve the filesystem location of the process bundle, or
  853. * executable if unbundled.
  854. *
  855. * Discussion:
  856. * Retrieves a reference to the filesystem location of the specified
  857. * application. For an application that is packaged as an app
  858. * bundle, this will be the app bundle directory; otherwise it will
  859. * be the location of the executable itself.
  860. *
  861. * Mac OS X threading:
  862. * Thread safe since version 10.3
  863. *
  864. * Parameters:
  865. *
  866. * psn:
  867. * Serial number of the target process
  868. *
  869. * location:
  870. * Location of the bundle or executable, as an FSRef
  871. *
  872. * Availability:
  873. * Mac OS X: in version 10.0 and later in ApplicationServices.framework
  874. * CarbonLib: in CarbonLib 1.5 and later
  875. * Non-Carbon CFM: not available
  876. }
  877. function GetProcessBundleLocation( const (*var*) psn: ProcessSerialNumber; var location: FSRef ): OSStatus; external name '_GetProcessBundleLocation';
  878. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  879. {
  880. * CopyProcessName()
  881. *
  882. * Summary:
  883. * Get a copy of the name of a process.
  884. *
  885. * Discussion:
  886. * Use this call to get the name of a process as a CFString. The
  887. * name returned is a copy, so the caller must CFRelease the name
  888. * when finished with it. The difference between this call and the
  889. * processName field filled in by GetProcessInformation is that the
  890. * name here is a CFString, and thus is capable of representing a
  891. * multi-lingual name, whereas previously only a mac-encoded string
  892. * was possible.
  893. *
  894. * Mac OS X threading:
  895. * Thread safe since version 10.3
  896. *
  897. * Parameters:
  898. *
  899. * psn:
  900. * Serial number of the target process
  901. *
  902. * name:
  903. * CFString representing the name of the process (must be released
  904. * by caller with CFRelease)
  905. *
  906. * Availability:
  907. * Mac OS X: in version 10.0 and later in ApplicationServices.framework
  908. * CarbonLib: in CarbonLib 1.5 and later
  909. * Non-Carbon CFM: not available
  910. }
  911. function CopyProcessName( const (*var*) psn: ProcessSerialNumber; var name: CFStringRef ): OSStatus; external name '_CopyProcessName';
  912. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  913. {
  914. * GetProcessPID()
  915. *
  916. * Summary:
  917. * Get the UNIX process ID corresponding to a process.
  918. *
  919. * Discussion:
  920. * Given a Process serial number, this call will get the UNIX
  921. * process ID for that process. Note that this call does not make
  922. * sense for Classic apps, since they all share a single UNIX
  923. * process ID.
  924. *
  925. * Mac OS X threading:
  926. * Thread safe since version 10.3
  927. *
  928. * Parameters:
  929. *
  930. * psn:
  931. * Serial number of the target process
  932. *
  933. * pid:
  934. * UNIX process ID of the process
  935. *
  936. * Availability:
  937. * Mac OS X: in version 10.0 and later in ApplicationServices.framework
  938. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
  939. * Non-Carbon CFM: not available
  940. }
  941. function GetProcessPID( const (*var*) psn: ProcessSerialNumber; var pid: pid_t ): OSStatus; external name '_GetProcessPID';
  942. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  943. {
  944. * GetProcessForPID()
  945. *
  946. * Summary:
  947. * Get the process serial number corresponding to a UNIX process ID.
  948. *
  949. * Discussion:
  950. * Given a UNIX process ID, this call will get the process serial
  951. * number for that process, if appropriate. Note that this call does
  952. * not make sense for Classic apps, since they all share a single
  953. * UNIX process ID.
  954. *
  955. * Mac OS X threading:
  956. * Thread safe since version 10.3
  957. *
  958. * Parameters:
  959. *
  960. * psn:
  961. * Serial number of the process
  962. *
  963. * pid:
  964. * UNIX process ID of the target process
  965. *
  966. * Availability:
  967. * Mac OS X: in version 10.0 and later in ApplicationServices.framework
  968. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
  969. * Non-Carbon CFM: not available
  970. }
  971. function GetProcessForPID( pid: pid_t; var psn: ProcessSerialNumber ): OSStatus; external name '_GetProcessForPID';
  972. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  973. {************************************************************************
  974. * Process Visibility.
  975. ************************************************************************}
  976. {
  977. * IsProcessVisible()
  978. *
  979. * Summary:
  980. * Determines whether a particular process is visible or not.
  981. *
  982. * Discussion:
  983. * Given a psn, this call will return true or false depending on
  984. * whether or not the process is currently visible.
  985. *
  986. * Mac OS X threading:
  987. * Thread safe since version 10.3
  988. *
  989. * Parameters:
  990. *
  991. * psn:
  992. * Serial number of the process
  993. *
  994. * Availability:
  995. * Mac OS X: in version 10.1 and later in ApplicationServices.framework
  996. * CarbonLib: in CarbonLib 1.5 and later
  997. * Non-Carbon CFM: not available
  998. }
  999. function IsProcessVisible( const (*var*) psn: ProcessSerialNumber ): Boolean; external name '_IsProcessVisible';
  1000. (* AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER *)
  1001. {
  1002. * ShowHideProcess()
  1003. *
  1004. * Summary:
  1005. * Hides or shows a given process.
  1006. *
  1007. * Discussion:
  1008. * Given a psn, this call will hide or show the process specified in
  1009. * the psn parameter. You determine whether you would like to show
  1010. * or hide the process with the visible parameter. True passed into
  1011. * visible indicates you wish for the process to become visible.
  1012. *
  1013. * Mac OS X threading:
  1014. * Thread safe since version 10.3
  1015. *
  1016. * Parameters:
  1017. *
  1018. * psn:
  1019. * Serial number of the process
  1020. *
  1021. * visible:
  1022. * true = show process; false = hide process
  1023. *
  1024. * Availability:
  1025. * Mac OS X: in version 10.1 and later in ApplicationServices.framework
  1026. * CarbonLib: in CarbonLib 1.5 and later
  1027. * Non-Carbon CFM: not available
  1028. }
  1029. function ShowHideProcess( const (*var*) psn: ProcessSerialNumber; visible: Boolean ): OSErr; external name '_ShowHideProcess';
  1030. (* AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER *)
  1031. {
  1032. * TransformProcessType()
  1033. *
  1034. * Summary:
  1035. * Changes the 'type' of the process specified in the psn parameter.
  1036. * The type is specified in the transformState parameter.
  1037. *
  1038. * Discussion:
  1039. * Given a psn for an application, this call transforms that
  1040. * application into the given type. Foreground applications have a
  1041. * menu bar and appear in the Dock. Background applications do not
  1042. * appear in the Dock, do not have a menu bar ( and should not have
  1043. * windows or other user interface ). UIElement applications do not
  1044. * have a menu bar, do not appear in the dock, but may in limited
  1045. * circumstances present windows and user interface. If a foreground
  1046. * application is frontmost when transformed into a background
  1047. * application, it is first hidden and another application is made
  1048. * frontmost. A UIElement or background-only application which is
  1049. * transformed into a foreground application is not brought to the
  1050. * front (use SetFrontProcess() after the transform if this is
  1051. * required) nor will it be shown if it is hidden ( even if hidden
  1052. * automatically by being transformed into a background-only
  1053. * application ), so the caller should use ShowHideProcess() to show
  1054. * the application after it is transformed into a foreground
  1055. * application. Applications can only transform themselves; this
  1056. * call cannot change the type of another application.
  1057. *
  1058. * Mac OS X threading:
  1059. * Thread safe since version 10.3
  1060. *
  1061. * Parameters:
  1062. *
  1063. * psn:
  1064. * Serial number of the process
  1065. *
  1066. * transformState:
  1067. * state to tranform the application to.
  1068. *
  1069. * Availability:
  1070. * Mac OS X: in version 10.3 and later in ApplicationServices.framework
  1071. * CarbonLib: not available in CarbonLib 1.x
  1072. * Non-Carbon CFM: not available
  1073. }
  1074. function TransformProcessType( const (*var*) psn: ProcessSerialNumber; transformState: ProcessApplicationTransformState ): OSStatus; external name '_TransformProcessType';
  1075. (* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
  1076. { Values of the 'message' parameter to a Control Panel 'cdev' }
  1077. const
  1078. initDev = 0; {Time for cdev to initialize itself}
  1079. hitDev = 1; {Hit on one of my items}
  1080. closeDev = 2; {Close yourself}
  1081. nulDev = 3; {Null event}
  1082. updateDev = 4; {Update event}
  1083. activDev = 5; {Activate event}
  1084. deactivDev = 6; {Deactivate event}
  1085. keyEvtDev = 7; {Key down/auto key}
  1086. macDev = 8; {Decide whether or not to show up}
  1087. undoDev = 9;
  1088. cutDev = 10;
  1089. copyDev = 11;
  1090. pasteDev = 12;
  1091. clearDev = 13;
  1092. cursorDev = 14;
  1093. { Special values a Control Panel 'cdev' can return }
  1094. const
  1095. cdevGenErr = -1; {General error; gray cdev w/o alert}
  1096. cdevMemErr = 0; {Memory shortfall; alert user please}
  1097. cdevResErr = 1; {Couldn't get a needed resource; alert}
  1098. cdevUnset = 3; { cdevValue is initialized to this}
  1099. { Control Panel Default Proc }
  1100. {$endc} {TARGET_OS_MAC}
  1101. {$ifc not defined MACOSALLINCLUDE or not MACOSALLINCLUDE}
  1102. end.
  1103. {$endc} {not MACOSALLINCLUDE}