Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

Previous Book Contents Book Index Next

Inside Macintosh: Interapplication Communication /
Chapter 4 - Responding to Apple Events / Reference to Responding to Apple Events
Routines for Responding to Apple Events / Coercing Descriptor Types


AECoercePtr

You can use the AECoercePtr function to coerce data to a desired descriptor type. If successful, it creates a descriptor record containing the newly coerced data.

FUNCTION AECoercePtr (typeCode: DescType; dataPtr: Ptr; 
                      dataSize: Size; toType: DescType; 
                      VAR result: AEDesc): OSErr;
typeCode
The descriptor type of the source data.
dataPtr
A pointer to the data to be coerced.
dataSize
The length, in bytes, of the data to be coerced.
toType
The desired descriptor type of the resulting descriptor record.
result
The resulting descriptor record.
DESCRIPTION
The AECoercePtr function creates a new descriptor record by coercing the specified data to a descriptor record of the specified descriptor type. You should use the AEDisposeDesc function to dispose of the resulting descriptor record once you are finished using it.

If AECoercePtr returns a nonzero result code, it returns a null descriptor record unless the Apple Event Manager is not available because of limited memory.

RESULT CODES
noErr0No error
memFullErr-108Not enough room in heap zone
errAECoercionFail -1700Data could not be coerced to the requested descriptor type
SEE ALSO
For a description of the AEDisposeDesc function, see page 4-93.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
7 JUL 1996