AECoercePtr
AECoercePtr Coerce data into descriptor type using a pointer
#include <AppleEvents.h> Apple Event Manager
OSErr AECoercePtr ( typeCode, dataPtr, dataSize, toType, result );
DescType * typeCode ; descriptor type of source data
Ptr dataPtr ; pointer to data to be coerced
Size dataSize ; maximum size of data to be coerced
DescType toType ; pointer to descriptor type
AEDesc * result ; resulting descriptor record
returns Error Code; 0 = no error
The AECoercePtr function takes a pointer to data and a desired descriptor
type and attempts to coerce the data into the desired descriptor type. If
successful, it creates a descriptor record containing the newly coerced data.
The typeCode parameter is the descriptor type of the source data.
The dataPtr parameter is a pointer to the data to be coerced.
The dataSize parameter is the length, in bytes, of the data to be coerced.
The toType parameter is the desired descriptor type of the resulting
descriptor record.
The AECoercePtr function returns in the result parameter the resulting
descriptor record. This function creates a new descriptor record by copying
the descriptor record from the parameter. Your application is responsible for
using the AEDisposeDesc function to dispose of the resulting descriptor
record once you are finished using it.
If the function returns a nonzero result code, a descriptor record with the
typeNull descriptor type is returned. A descriptor record of this type does not
contain any data.
Note: To avoid infinite recursion, AECoercePtr must never be called by an
application-supplied coercion routine.
For an example program showing use of AEDisposeDesc, see the description
of Open Documents Event.
Result codes
noErr (0) No error
memFullErr (-108) Not enough room in heap zone
errAECoercionFail (-1700) Data could not be coerced to descriptor type