Defines a pointer to a function that coerces data stored in a descriptor. Your descriptor coercion callback function coerces the data from the passed descriptor to the specified type, returning the coerced data in a second descriptor.
Mac Catalyst 13.0+
A pointer to the descriptor that contains the data to coerce. See AEDesc.
A reference constant that is stored in the coercion dispatch table entry for the handler. The Apple Event Manager passes this value to the handler each time it calls it. The reference constant may have a value of 0.
A pointer to a descriptor where your coercion routine must store the descriptor that contains the coerced data. See AEDesc.
A result code. See Result Codes. Your handler should return noErr if it successfully handled the coercion, errAECoercionFailed if it can’t handle the coercion and it wants the Apple Event Manager to continue dispatching to other coercion handlers, or a nonzero result code otherwise.
Your coercion handler should coerce the data to the desired descriptor type and return the resulting data in the descriptor specified by the result parameter.
To provide a pointer to your descriptor coercion callback function, you create a universal procedure pointer (UPP) of type AECoerceDescUPP, using the function NewAECoerceDescUPP(_:). You can do so with code like the following:
You can then pass the UPP MyCoerceDescUPP as a parameter to any function that installs or removes a coercion handler, such as AEInstallCoercionHandler(_:_:_:_:_:_:). If your application installs the same coercion handler to coerce more than one type of data, you can use the same UPP to install the handler multiple times.
After you are finished with a descriptor coercion callback function, and have removed it with the AERemoveCoercionHandler(_:_:_:_:) function, you can dispose of the UPP with the DisposeAECoerceDescUPP(_:) function. However, don’t dispose of the UPP if any remaining coercion handler uses it or if you plan to install the coercion handler again.
Defines a pointer to a function the Apple Event Manager calls when the asynchronous execution of a remote process resolver completes, either due to success or failure, after a call to the AERemoteProcessResolverScheduleWithRunLoop function. Your callback function can use the reference passed to it to get the remote process information.
Defines a pointer to a function the Apple Event Manager calls to dispose of a descriptor created by the AECreateDescFromExternalPtr function. Your callback function disposes of the buffer you originally passed to that function.
Defines a pointer to a function that coerces data stored in a buffer. Your pointer coercion callback routine coerces the data from the passed buffer to the specified type, returning the coerced data in a descriptor.
Defines a pointer to a function that handles one or more Apple events. Your Apple event handler function performs any action requested by the Apple event, adds parameters to the reply Apple event if appropriate (possibly including error information), and returns a result code.
Defines a pointer to an error descriptor callback function. Your error descriptor callback function supplies a pointer to an address where the Apple Event Manager can store the current descriptor if an error occurs during a call to the AEResolve function.