AppleEvents.pas 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702
  1. {
  2. File: AE/AppleEvents.h
  3. Contains: AppleEvent Package Interfaces.
  4. Copyright: © 1989-2008 by Apple Computer, Inc., all rights reserved
  5. Bugs?: For bug reports, consult the following page on
  6. the World Wide Web:
  7. http://bugs.freepascal.org
  8. }
  9. { Pascal Translation Updated: Jonas Maebe, <[email protected]>, October 2009 }
  10. { Pascal Translation Updated: Jonas Maebe, <[email protected]>, September 2012 }
  11. {
  12. Modified for use with Free Pascal
  13. Version 308
  14. Please report any bugs to <[email protected]>
  15. }
  16. {$ifc not defined MACOSALLINCLUDE or not MACOSALLINCLUDE}
  17. {$mode macpas}
  18. {$modeswitch cblocks}
  19. {$packenum 1}
  20. {$macro on}
  21. {$inline on}
  22. {$calling mwpascal}
  23. {$IFNDEF FPC_DOTTEDUNITS}
  24. unit AppleEvents;
  25. {$ENDIF FPC_DOTTEDUNITS}
  26. interface
  27. {$setc UNIVERSAL_INTERFACES_VERSION := $0400}
  28. {$setc GAP_INTERFACES_VERSION := $0308}
  29. {$ifc not defined USE_CFSTR_CONSTANT_MACROS}
  30. {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
  31. {$endc}
  32. {$ifc defined CPUPOWERPC and defined CPUI386}
  33. {$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
  34. {$endc}
  35. {$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
  36. {$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
  37. {$endc}
  38. {$ifc not defined __ppc__ and defined CPUPOWERPC32}
  39. {$setc __ppc__ := 1}
  40. {$elsec}
  41. {$setc __ppc__ := 0}
  42. {$endc}
  43. {$ifc not defined __ppc64__ and defined CPUPOWERPC64}
  44. {$setc __ppc64__ := 1}
  45. {$elsec}
  46. {$setc __ppc64__ := 0}
  47. {$endc}
  48. {$ifc not defined __i386__ and defined CPUI386}
  49. {$setc __i386__ := 1}
  50. {$elsec}
  51. {$setc __i386__ := 0}
  52. {$endc}
  53. {$ifc not defined __x86_64__ and defined CPUX86_64}
  54. {$setc __x86_64__ := 1}
  55. {$elsec}
  56. {$setc __x86_64__ := 0}
  57. {$endc}
  58. {$ifc not defined __arm__ and defined CPUARM}
  59. {$setc __arm__ := 1}
  60. {$elsec}
  61. {$setc __arm__ := 0}
  62. {$endc}
  63. {$ifc not defined __arm64__ and defined CPUAARCH64}
  64. {$setc __arm64__ := 1}
  65. {$elsec}
  66. {$setc __arm64__ := 0}
  67. {$endc}
  68. {$ifc defined cpu64}
  69. {$setc __LP64__ := 1}
  70. {$elsec}
  71. {$setc __LP64__ := 0}
  72. {$endc}
  73. {$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
  74. {$error Conflicting definitions for __ppc__ and __i386__}
  75. {$endc}
  76. {$ifc defined __ppc__ and __ppc__}
  77. {$setc TARGET_CPU_PPC := TRUE}
  78. {$setc TARGET_CPU_PPC64 := FALSE}
  79. {$setc TARGET_CPU_X86 := FALSE}
  80. {$setc TARGET_CPU_X86_64 := FALSE}
  81. {$setc TARGET_CPU_ARM := FALSE}
  82. {$setc TARGET_CPU_ARM64 := FALSE}
  83. {$setc TARGET_OS_MAC := TRUE}
  84. {$setc TARGET_OS_IPHONE := FALSE}
  85. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  86. {$setc TARGET_OS_EMBEDDED := FALSE}
  87. {$elifc defined __ppc64__ and __ppc64__}
  88. {$setc TARGET_CPU_PPC := FALSE}
  89. {$setc TARGET_CPU_PPC64 := TRUE}
  90. {$setc TARGET_CPU_X86 := FALSE}
  91. {$setc TARGET_CPU_X86_64 := FALSE}
  92. {$setc TARGET_CPU_ARM := FALSE}
  93. {$setc TARGET_CPU_ARM64 := FALSE}
  94. {$setc TARGET_OS_MAC := TRUE}
  95. {$setc TARGET_OS_IPHONE := FALSE}
  96. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  97. {$setc TARGET_OS_EMBEDDED := FALSE}
  98. {$elifc defined __i386__ and __i386__}
  99. {$setc TARGET_CPU_PPC := FALSE}
  100. {$setc TARGET_CPU_PPC64 := FALSE}
  101. {$setc TARGET_CPU_X86 := TRUE}
  102. {$setc TARGET_CPU_X86_64 := FALSE}
  103. {$setc TARGET_CPU_ARM := FALSE}
  104. {$setc TARGET_CPU_ARM64 := FALSE}
  105. {$ifc defined iphonesim}
  106. {$setc TARGET_OS_MAC := FALSE}
  107. {$setc TARGET_OS_IPHONE := TRUE}
  108. {$setc TARGET_IPHONE_SIMULATOR := TRUE}
  109. {$elsec}
  110. {$setc TARGET_OS_MAC := TRUE}
  111. {$setc TARGET_OS_IPHONE := FALSE}
  112. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  113. {$endc}
  114. {$setc TARGET_OS_EMBEDDED := FALSE}
  115. {$elifc defined __x86_64__ and __x86_64__}
  116. {$setc TARGET_CPU_PPC := FALSE}
  117. {$setc TARGET_CPU_PPC64 := FALSE}
  118. {$setc TARGET_CPU_X86 := FALSE}
  119. {$setc TARGET_CPU_X86_64 := TRUE}
  120. {$setc TARGET_CPU_ARM := FALSE}
  121. {$setc TARGET_CPU_ARM64 := FALSE}
  122. {$ifc defined iphonesim}
  123. {$setc TARGET_OS_MAC := FALSE}
  124. {$setc TARGET_OS_IPHONE := TRUE}
  125. {$setc TARGET_IPHONE_SIMULATOR := TRUE}
  126. {$elsec}
  127. {$setc TARGET_OS_MAC := TRUE}
  128. {$setc TARGET_OS_IPHONE := FALSE}
  129. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  130. {$endc}
  131. {$setc TARGET_OS_EMBEDDED := FALSE}
  132. {$elifc defined __arm__ and __arm__}
  133. {$setc TARGET_CPU_PPC := FALSE}
  134. {$setc TARGET_CPU_PPC64 := FALSE}
  135. {$setc TARGET_CPU_X86 := FALSE}
  136. {$setc TARGET_CPU_X86_64 := FALSE}
  137. {$setc TARGET_CPU_ARM := TRUE}
  138. {$setc TARGET_CPU_ARM64 := FALSE}
  139. {$setc TARGET_OS_MAC := FALSE}
  140. {$setc TARGET_OS_IPHONE := TRUE}
  141. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  142. {$setc TARGET_OS_EMBEDDED := TRUE}
  143. {$elifc defined __arm64__ and __arm64__}
  144. {$setc TARGET_CPU_PPC := FALSE}
  145. {$setc TARGET_CPU_PPC64 := FALSE}
  146. {$setc TARGET_CPU_X86 := FALSE}
  147. {$setc TARGET_CPU_X86_64 := FALSE}
  148. {$setc TARGET_CPU_ARM := FALSE}
  149. {$setc TARGET_CPU_ARM64 := TRUE}
  150. {$ifc defined ios}
  151. {$setc TARGET_OS_MAC := FALSE}
  152. {$setc TARGET_OS_IPHONE := TRUE}
  153. {$setc TARGET_OS_EMBEDDED := TRUE}
  154. {$elsec}
  155. {$setc TARGET_OS_MAC := TRUE}
  156. {$setc TARGET_OS_IPHONE := FALSE}
  157. {$setc TARGET_OS_EMBEDDED := FALSE}
  158. {$endc}
  159. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  160. {$elsec}
  161. {$error __ppc__ nor __ppc64__ nor __i386__ nor __x86_64__ nor __arm__ nor __arm64__ is defined.}
  162. {$endc}
  163. {$ifc defined __LP64__ and __LP64__ }
  164. {$setc TARGET_CPU_64 := TRUE}
  165. {$elsec}
  166. {$setc TARGET_CPU_64 := FALSE}
  167. {$endc}
  168. {$ifc defined FPC_BIG_ENDIAN}
  169. {$setc TARGET_RT_BIG_ENDIAN := TRUE}
  170. {$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
  171. {$elifc defined FPC_LITTLE_ENDIAN}
  172. {$setc TARGET_RT_BIG_ENDIAN := FALSE}
  173. {$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
  174. {$elsec}
  175. {$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
  176. {$endc}
  177. {$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
  178. {$setc CALL_NOT_IN_CARBON := FALSE}
  179. {$setc OLDROUTINENAMES := FALSE}
  180. {$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
  181. {$setc OPAQUE_UPP_TYPES := TRUE}
  182. {$setc OTCARBONAPPLICATION := TRUE}
  183. {$setc OTKERNEL := FALSE}
  184. {$setc PM_USE_SESSION_APIS := TRUE}
  185. {$setc TARGET_API_MAC_CARBON := TRUE}
  186. {$setc TARGET_API_MAC_OS8 := FALSE}
  187. {$setc TARGET_API_MAC_OSX := TRUE}
  188. {$setc TARGET_CARBON := TRUE}
  189. {$setc TARGET_CPU_68K := FALSE}
  190. {$setc TARGET_CPU_MIPS := FALSE}
  191. {$setc TARGET_CPU_SPARC := FALSE}
  192. {$setc TARGET_OS_UNIX := FALSE}
  193. {$setc TARGET_OS_WIN32 := FALSE}
  194. {$setc TARGET_RT_MAC_68881 := FALSE}
  195. {$setc TARGET_RT_MAC_CFM := FALSE}
  196. {$setc TARGET_RT_MAC_MACHO := TRUE}
  197. {$setc TYPED_FUNCTION_POINTERS := TRUE}
  198. {$setc TYPE_BOOL := FALSE}
  199. {$setc TYPE_EXTENDED := FALSE}
  200. {$setc TYPE_LONGLONG := TRUE}
  201. {$IFDEF FPC_DOTTEDUNITS}
  202. uses MacOsApi.MacTypes,MacOsApi.MixedMode,MacOsApi.AEDataModel,MacOsApi.AEInteraction, MacOsApi.CFArray, MacOsApi.CFBase, MacOsApi.CFRunLoop, MacOsApi.CFStream, MacOsApi.CFURL;
  203. {$ELSE FPC_DOTTEDUNITS}
  204. uses MacTypes,MixedMode,AEDataModel,AEInteraction, CFArray, CFBase, CFRunLoop, CFStream, CFURL;
  205. {$ENDIF FPC_DOTTEDUNITS}
  206. {$endc} {not MACOSALLINCLUDE}
  207. {$ifc TARGET_OS_MAC}
  208. {
  209. Note: The functions and types for the building and parsing AppleEvent
  210. messages has moved to AEDataModel.h
  211. }
  212. {$ALIGN MAC68K}
  213. const
  214. { Keywords for Apple event parameters }
  215. keyDirectObject = FourCharCode('----');
  216. keyErrorNumber = FourCharCode('errn');
  217. keyErrorString = FourCharCode('errs');
  218. keyProcessSerialNumber = FourCharCode('psn '); { Keywords for special handlers }
  219. keyPreDispatch = FourCharCode('phac'); { preHandler accessor call }
  220. keySelectProc = FourCharCode('selh'); { more selector call }
  221. { Keyword for recording }
  222. keyAERecorderCount = FourCharCode('recr'); { available only in vers 1.0.1 and greater }
  223. { Keyword for version information }
  224. keyAEVersion = FourCharCode('vers'); { available only in vers 1.0.1 and greater }
  225. { Event Class }
  226. const
  227. kCoreEventClass = FourCharCode('aevt');
  228. { Event ID's }
  229. const
  230. kAEOpenApplication = FourCharCode('oapp');
  231. kAEOpenDocuments = FourCharCode('odoc');
  232. kAEPrintDocuments = FourCharCode('pdoc');
  233. kAEOpenContents = FourCharCode('ocon');
  234. kAEQuitApplication = FourCharCode('quit'); { may include a property kAEQuitReason indicating what lead to the quit being sent. }
  235. kAEAnswer = FourCharCode('ansr');
  236. kAEApplicationDied = FourCharCode('obit');
  237. kAEShowPreferences = FourCharCode('pref'); { sent by Mac OS X when the user chooses the Preferences item }
  238. { Constants for recording }
  239. const
  240. kAEStartRecording = FourCharCode('reca'); { available only in vers 1.0.1 and greater }
  241. kAEStopRecording = FourCharCode('recc'); { available only in vers 1.0.1 and greater }
  242. kAENotifyStartRecording = FourCharCode('rec1'); { available only in vers 1.0.1 and greater }
  243. kAENotifyStopRecording = FourCharCode('rec0'); { available only in vers 1.0.1 and greater }
  244. kAENotifyRecording = FourCharCode('recr'); { available only in vers 1.0.1 and greater }
  245. {
  246. * AEEventSource is defined as an SInt8 for compatability with pascal.
  247. * Important note: keyEventSourceAttr is returned by AttributePtr as a typeShortInteger.
  248. * Be sure to pass at least two bytes of storage to AEGetAttributePtr - the result can be
  249. * compared directly against the following enums.
  250. }
  251. type
  252. AEEventSource = SInt8;
  253. const
  254. kAEUnknownSource = 0;
  255. kAEDirectCall = 1;
  256. kAESameProcess = 2;
  257. kAELocalProcess = 3;
  258. kAERemoteProcess = 4;
  259. { if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 }
  260. const
  261. errAETargetAddressNotPermitted = -1742; { Mac OS X 10.8 and later, the target of an AppleEvent is not accessible to this process, perhaps due to sandboxing }
  262. errAEEventNotPermitted = -1743; { Mac OS X 10.8 and later, the target of the AppleEvent does not allow this sender to execute this event }
  263. { endif }
  264. {*************************************************************************
  265. These calls are used to set up and modify the event dispatch table.
  266. *************************************************************************}
  267. {
  268. * AEInstallEventHandler()
  269. *
  270. * Mac OS X threading:
  271. * Thread safe since version 10.2
  272. *
  273. * Availability:
  274. * Mac OS X: in version 10.0 and later in ApplicationServices.framework
  275. * CarbonLib: in CarbonLib 1.0 and later
  276. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  277. }
  278. function AEInstallEventHandler( theAEEventClass: AEEventClass; theAEEventID: AEEventID; handler: AEEventHandlerUPP; handlerRefcon: SRefCon; isSysHandler: Boolean ): OSErr; external name '_AEInstallEventHandler';
  279. (* __OSX_AVAILABLE_STARTING( __MAC_10_0, __IPHONE_NA ) *)
  280. {
  281. * AERemoveEventHandler()
  282. *
  283. * Mac OS X threading:
  284. * Thread safe since version 10.2
  285. *
  286. * Availability:
  287. * Mac OS X: in version 10.0 and later in ApplicationServices.framework
  288. * CarbonLib: in CarbonLib 1.0 and later
  289. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  290. }
  291. function AERemoveEventHandler( theAEEventClass: AEEventClass; theAEEventID: AEEventID; handler: AEEventHandlerUPP; isSysHandler: Boolean ): OSErr; external name '_AERemoveEventHandler';
  292. (* __OSX_AVAILABLE_STARTING( __MAC_10_0, __IPHONE_NA ) *)
  293. {
  294. * AEGetEventHandler()
  295. *
  296. * Mac OS X threading:
  297. * Thread safe since version 10.2
  298. *
  299. * Availability:
  300. * Mac OS X: in version 10.0 and later in ApplicationServices.framework
  301. * CarbonLib: in CarbonLib 1.0 and later
  302. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  303. }
  304. function AEGetEventHandler( theAEEventClass: AEEventClass; theAEEventID: AEEventID; var handler: AEEventHandlerUPP; var handlerRefcon: SRefCon; isSysHandler: Boolean ): OSErr; external name '_AEGetEventHandler';
  305. (* __OSX_AVAILABLE_STARTING( __MAC_10_0, __IPHONE_NA ) *)
  306. {*************************************************************************
  307. These calls are used to set up and modify special hooks into the
  308. AppleEvent manager.
  309. *************************************************************************}
  310. {
  311. * AEInstallSpecialHandler()
  312. *
  313. * Mac OS X threading:
  314. * Thread safe since version 10.2
  315. *
  316. * Availability:
  317. * Mac OS X: in version 10.0 and later in ApplicationServices.framework
  318. * CarbonLib: in CarbonLib 1.0 and later
  319. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  320. }
  321. function AEInstallSpecialHandler( functionClass: AEKeyword; handler: AEEventHandlerUPP; isSysHandler: Boolean ): OSErr; external name '_AEInstallSpecialHandler';
  322. (* __OSX_AVAILABLE_STARTING( __MAC_10_0, __IPHONE_NA ) *)
  323. {
  324. * AERemoveSpecialHandler()
  325. *
  326. * Mac OS X threading:
  327. * Thread safe since version 10.2
  328. *
  329. * Availability:
  330. * Mac OS X: in version 10.0 and later in ApplicationServices.framework
  331. * CarbonLib: in CarbonLib 1.0 and later
  332. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  333. }
  334. function AERemoveSpecialHandler( functionClass: AEKeyword; handler: AEEventHandlerUPP; isSysHandler: Boolean ): OSErr; external name '_AERemoveSpecialHandler';
  335. (* __OSX_AVAILABLE_STARTING( __MAC_10_0, __IPHONE_NA ) *)
  336. {
  337. * AEGetSpecialHandler()
  338. *
  339. * Mac OS X threading:
  340. * Thread safe since version 10.2
  341. *
  342. * Availability:
  343. * Mac OS X: in version 10.0 and later in ApplicationServices.framework
  344. * CarbonLib: in CarbonLib 1.0 and later
  345. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  346. }
  347. function AEGetSpecialHandler( functionClass: AEKeyword; var handler: AEEventHandlerUPP; isSysHandler: Boolean ): OSErr; external name '_AEGetSpecialHandler';
  348. (* __OSX_AVAILABLE_STARTING( __MAC_10_0, __IPHONE_NA ) *)
  349. {*************************************************************************
  350. This call was added in version 1.0.1. If called with the keyword
  351. keyAERecorderCount ('recr'), the number of recorders that are
  352. currently active is returned in 'result'
  353. (available only in vers 1.0.1 and greater).
  354. *************************************************************************}
  355. {
  356. * AEManagerInfo()
  357. *
  358. * Mac OS X threading:
  359. * Thread safe since version 10.2
  360. *
  361. * Availability:
  362. * Mac OS X: in version 10.0 and later in ApplicationServices.framework
  363. * CarbonLib: in CarbonLib 1.0 and later
  364. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  365. }
  366. function AEManagerInfo( keyWord: AEKeyword; var result: SIGNEDLONG ): OSErr; external name '_AEManagerInfo';
  367. (* __OSX_AVAILABLE_STARTING( __MAC_10_0, __IPHONE_NA ) *)
  368. {
  369. AERemoteProcessResolver:
  370. These calls subsume the functionality of using the PPCToolbox on Mac
  371. OS 9 to locate processes on remote computers. (PPCToolbox is not
  372. part of Carbon.) These calls are supported on Mac OS X 10.3 or
  373. later.
  374. The model is to create a resolver for a particular URL and schedule
  375. it on a CFRunLoop to retrieve the results asynchronously. If
  376. synchronous behavior is desired, just call
  377. AERemoteProcessResolverGetProcesses to get the array; the call will
  378. block until the request is completed.
  379. A resolver can only be used once; once it has fetched the data or
  380. gotten an error it can no longer be scheduled.
  381. The data obtained from the resolver is a CFArrayRef of
  382. CFDictionaryRef objects. Each dictionary contains the URL of the
  383. remote application and its human readable name.
  384. }
  385. {
  386. * kAERemoteProcessURLKey
  387. *
  388. * Discussion:
  389. * the full URL to this application, a CFURLRef.
  390. *
  391. * Availability:
  392. * Mac OS X: in version 10.3 and later in ApplicationServices.framework
  393. * CarbonLib: not available
  394. * Non-Carbon CFM: not available
  395. }
  396. var kAERemoteProcessURLKey: CFStringRef; external name '_kAERemoteProcessURLKey'; (* attribute const *)
  397. (* __OSX_AVAILABLE_STARTING( __MAC_10_3, __IPHONE_NA ) *)
  398. {
  399. * kAERemoteProcessNameKey
  400. *
  401. * Discussion:
  402. * the visible name to this application, in the localization
  403. * supplied by the server, a CFStringRef.
  404. *
  405. * Availability:
  406. * Mac OS X: in version 10.3 and later in ApplicationServices.framework
  407. * CarbonLib: not available
  408. * Non-Carbon CFM: not available
  409. }
  410. var kAERemoteProcessNameKey: CFStringRef; external name '_kAERemoteProcessNameKey'; (* attribute const *)
  411. (* __OSX_AVAILABLE_STARTING( __MAC_10_3, __IPHONE_NA ) *)
  412. {
  413. * kAERemoteProcessUserIDKey
  414. *
  415. * Discussion:
  416. * the userid of this application, if available. If present, a
  417. * CFNumberRef.
  418. *
  419. * Availability:
  420. * Mac OS X: in version 10.3 and later in ApplicationServices.framework
  421. * CarbonLib: not available
  422. * Non-Carbon CFM: not available
  423. }
  424. var kAERemoteProcessUserIDKey: CFStringRef; external name '_kAERemoteProcessUserIDKey'; (* attribute const *)
  425. (* __OSX_AVAILABLE_STARTING( __MAC_10_3, __IPHONE_NA ) *)
  426. {
  427. * kAERemoteProcessProcessIDKey
  428. *
  429. * Discussion:
  430. * the process id of this application, if available. If present, a
  431. * CFNumberRef.
  432. *
  433. * Availability:
  434. * Mac OS X: in version 10.3 and later in ApplicationServices.framework
  435. * CarbonLib: not available
  436. * Non-Carbon CFM: not available
  437. }
  438. var kAERemoteProcessProcessIDKey: CFStringRef; external name '_kAERemoteProcessProcessIDKey'; (* attribute const *)
  439. (* __OSX_AVAILABLE_STARTING( __MAC_10_3, __IPHONE_NA ) *)
  440. {
  441. * AERemoteProcessResolverContext
  442. *
  443. * Discussion:
  444. * An optional context parameter for asynchronous resolution. The
  445. * context is copied and the info pointer retained. When the
  446. * callback is made, the info pointer is passed to the callback.
  447. }
  448. type
  449. AERemoteProcessResolverContextPtr = ^AERemoteProcessResolverContext;
  450. AERemoteProcessResolverContext = record
  451. {
  452. * set to zero (0)
  453. }
  454. version: CFIndex;
  455. {
  456. * info pointer to be passed to the callback
  457. }
  458. info: UnivPtr;
  459. {
  460. * callback made on the info pointer. This field may be NULL.
  461. }
  462. retain: CFAllocatorRetainCallBack;
  463. {
  464. * callback made on the info pointer. This field may be NULL.
  465. }
  466. release: CFAllocatorReleaseCallBack;
  467. {
  468. * callback made on the info pointer. This field may be NULL.
  469. }
  470. copyDescription: CFAllocatorCopyDescriptionCallBack;
  471. end;
  472. {
  473. * AERemoteProcessResolverRef
  474. *
  475. * Discussion:
  476. * An opaque reference to an object that encapsulates the mechnanism
  477. * by which a list of processes running on a remote machine are
  478. * obtained. Created by AECreateRemoteProcessResolver, and must be
  479. * disposed of by AEDisposeRemoteProcessResolver. A
  480. * AERemoteProcessResolverRef is not a CFType.
  481. }
  482. type
  483. AERemoteProcessResolverRef = ^SInt32; { an opaque type }
  484. {
  485. * AECreateRemoteProcessResolver()
  486. *
  487. * Discussion:
  488. * Create a Remote Process List Resolver object. The allocator is
  489. * used for any CoreFoundation types created or returned by this
  490. * API. The resulting object can be scheduled on a run loop, or
  491. * queried synchronously. Once the object has retreived results
  492. * from the server, or got an error doing so, it will not re-fetch
  493. * the data. To retrieve a new list of processes, create a new
  494. * instance of this object.
  495. *
  496. * Mac OS X threading:
  497. * Thread safe since version 10.3
  498. *
  499. * Parameters:
  500. *
  501. * allocator:
  502. * a CFAllocatorRef to use when creating CFTypes
  503. *
  504. * url:
  505. * a CFURL identifying the remote host and port.
  506. *
  507. * Result:
  508. * a AECreateRemoteProcessResolverRef, which must be disposed of
  509. * with AEDisposeRemoteProcessResolver.
  510. *
  511. * Availability:
  512. * Mac OS X: in version 10.3 and later in ApplicationServices.framework
  513. * CarbonLib: not available
  514. * Non-Carbon CFM: not available
  515. }
  516. function AECreateRemoteProcessResolver( allocator: CFAllocatorRef; url: CFURLRef ): AERemoteProcessResolverRef; external name '_AECreateRemoteProcessResolver';
  517. (* __OSX_AVAILABLE_STARTING( __MAC_10_3, __IPHONE_NA ) *)
  518. {
  519. * AEDisposeRemoteProcessResolver()
  520. *
  521. * Discussion:
  522. * Disposes of a AERemoteProcessResolverRef. If this resolver is
  523. * currently scheduled on a run loop, it is unscheduled. In this
  524. * case, the asynchronous callback will not be executed.
  525. *
  526. * Mac OS X threading:
  527. * Thread safe since version 10.3
  528. *
  529. * Parameters:
  530. *
  531. * ref:
  532. * The AERemoteProcessResolverRef to dispose
  533. *
  534. * Availability:
  535. * Mac OS X: in version 10.3 and later in ApplicationServices.framework
  536. * CarbonLib: not available
  537. * Non-Carbon CFM: not available
  538. }
  539. procedure AEDisposeRemoteProcessResolver( ref: AERemoteProcessResolverRef ); external name '_AEDisposeRemoteProcessResolver';
  540. (* __OSX_AVAILABLE_STARTING( __MAC_10_3, __IPHONE_NA ) *)
  541. {
  542. * AERemoteProcessResolverGetProcesses()
  543. *
  544. * Discussion:
  545. * Returns a CFArrayRef containing CFDictionary objects containing
  546. * information about processses running on a remote machine. If the
  547. * result array is NULL, the query failed and the error out
  548. * parameter will contain information about the failure. If the
  549. * resolver had not been previously scheduled for execution, this
  550. * call will block until the resulting array is available or an
  551. * error occurs. If the resolver had been scheduled but had not yet
  552. * completed fetching the array, this call will block until the
  553. * resolver does complete. The array returned is owned by the
  554. * resolver, so callers must retain it before disposing of the
  555. * resolver object itself.
  556. *
  557. * Mac OS X threading:
  558. * Thread safe since version 10.3
  559. *
  560. * Parameters:
  561. *
  562. * ref:
  563. * The AERemoteProcessResolverRef to query
  564. *
  565. * outError:
  566. * If the result is NULL, outError will contain a CFStreamError
  567. * with information about the type of failure
  568. *
  569. * Result:
  570. * a CFArray of CFDictionary objects containing information about
  571. * the remote applications.
  572. *
  573. * Availability:
  574. * Mac OS X: in version 10.3 and later in ApplicationServices.framework
  575. * CarbonLib: not available
  576. * Non-Carbon CFM: not available
  577. }
  578. function AERemoteProcessResolverGetProcesses( ref: AERemoteProcessResolverRef; var outError: CFStreamError ): CFArrayRef; external name '_AERemoteProcessResolverGetProcesses';
  579. (* __OSX_AVAILABLE_STARTING( __MAC_10_3, __IPHONE_NA ) *)
  580. {
  581. * AERemoteProcessResolverCallback
  582. *
  583. * Discussion:
  584. * A callback made when the asynchronous execution of a resolver
  585. * completes, either due to success or failure. The data itself
  586. * should be obtained with AERemoteProcessResolverGetProcesses.
  587. }
  588. type
  589. AERemoteProcessResolverCallback = procedure( ref: AERemoteProcessResolverRef; info: UnivPtr );
  590. {
  591. * AERemoteProcessResolverScheduleWithRunLoop()
  592. *
  593. * Discussion:
  594. * Schedules a resolver for execution on a given runloop in a given
  595. * mode. The resolver will move through various internal states as
  596. * long as the specified run loop is run. When the resolver
  597. * completes, either with success or an error condition, the
  598. * callback is executed. There is no explicit unschedule of the
  599. * resolver; you must dispose of it to remove it from the run loop.
  600. *
  601. * Mac OS X threading:
  602. * Thread safe since version 10.3
  603. *
  604. * Parameters:
  605. *
  606. * ref:
  607. * The AERemoteProcessResolverRef to scheduile
  608. *
  609. * runLoop:
  610. * a CFRunLoop
  611. *
  612. * runLoopMode:
  613. * a CFString specifying the run loop mode
  614. *
  615. * callback:
  616. * a callback to be executed when the reolver completes
  617. *
  618. * ctx:
  619. * a AERemoteProcessResolverContext. If this parameter is not
  620. * NULL, the info field of this structure will be passed to the
  621. * callback (otherwise, the callback info parameter will
  622. * explicitly be NULL.)
  623. *
  624. * Availability:
  625. * Mac OS X: in version 10.3 and later in ApplicationServices.framework
  626. * CarbonLib: not available
  627. * Non-Carbon CFM: not available
  628. }
  629. procedure AERemoteProcessResolverScheduleWithRunLoop( ref: AERemoteProcessResolverRef; runLoop: CFRunLoopRef; runLoopMode: CFStringRef; callback: AERemoteProcessResolverCallback; {const} ctx: AERemoteProcessResolverContextPtr { can be NULL } ); external name '_AERemoteProcessResolverScheduleWithRunLoop';
  630. (* __OSX_AVAILABLE_STARTING( __MAC_10_3, __IPHONE_NA ) *)
  631. {$endc} {TARGET_OS_MAC}
  632. {$ifc not defined MACOSALLINCLUDE or not MACOSALLINCLUDE}
  633. end.
  634. {$endc} {not MACOSALLINCLUDE}