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 / Getting Data and Keyword-Specified Descriptor Records Out of AE Records


AEGetKeyPtr

You can use the AEGetKeyPtr function to get a pointer to a buffer that contains the data from a keyword-specified descriptor record. You can use this function to get data from an AE record or an Apple event record.

FUNCTION AEGetKeyPtr (theAERecord: AERecord; 
                      theAEKeyword: AEKeyword; 
                      desiredType: DescType; 
                      VAR typeCode: DescType; 
                      dataPtr: Ptr; maximumSize: Size; 
                      VAR actualSize: Size): OSErr;
theAERecord

The AE record containing the desired data.
theAEKeyword
The keyword that specifies the desired descriptor record.
desiredType
The desired descriptor type for the data to be returned; if the requested data is not of this type, the Apple Event Manager attempts to coerce it to this type. If the value of desiredType is typeWildCard, no coercion is performed, and the descriptor type of returned data is the same as the descriptor type of the original data.
typeCode
The descriptor type of the returned data.
dataPtr
A pointer to the buffer for storing the data.
maximumSize

The maximum length, in bytes, of the data to be returned. You must allocate at least this amount of storage for the buffer specified by the dataPtr parameter.
actualSize
The length, in bytes, of the data for the keyword-specified descriptor record. If this value is larger than the value of the maximumSize parameter, not all of the data for the parameter was returned.
DESCRIPTION
The AEGetKeyPtr function uses a buffer to return the data from a keyword-specified Apple event parameter, which the function attempts to coerce to the descriptor type specified by the desiredType parameter.

RESULT CODES
noErr0No error
memFullErr-108Not enough room in heap zone
errAECoercionFail -1700Data could not be coerced to the requested descriptor type
errAEDescNotFound -1701Descriptor record was not found
errAEWrongDataType-1703Wrong descriptor type
errAENotAEDesc-1704Not a valid descriptor record
errAEReplyNotArrived-1718Reply has not yet arrived

Previous Book Contents Book Index Next

© Apple Computer, Inc.
7 JUL 1996