Getting Data Out of an Apple Event
Apple event and return it to your application in a format your application can
use.
parameters and attributes. Most of these functions are available in two forms:
one that returns the desired data in a specified buffer and one that returns a
descriptor record containing the same data. For example, the
AEGetParamPtr function returns the data of a specified parameter, and the parameter.
descriptor records, descriptor lists, and AE records. You use similar
functions to put data into descriptor records, descriptor lists, and
AE records.
When your handler receives an Apple event, you'll typically use the
data be returned using any descriptor type, even if it is different from the
original descriptor type. If the original data is of a different
the requested descriptor type.
For example, the AEGetParamPtr function lets you specify the desired descriptor type of the resulting data.
long multResult;
myErr = AEGetParamPtr(& theAppleEvent, keyMultResult, typeLongInteger, & returnedType, (Ptr) &multResult, sizeof(multResult), & actualSize);
In this example, the desired type is specified in the third parameter by the
typeLongInteger descriptor type. This requests that the
descriptor type (a long integer) if it is not already of this type.
To ensure that no coercion is performed and that the descriptor type of the
result is of the same type as the original, you can specify typeWildCard for the desired descriptor type.
in the fourth parameter. This is useful information when you specify
typeWildCard as the desired descriptor type; you can determine the descriptor type of the resulting data by examining the fourth parameter.
alias records to file system specification records (FSSpec), integers to Boolean data types, and characters to numeric data types, in addition to other You can also provide your own coercion handlers to coerce other data types.
Parameters are keyword-specified descriptor records. You can use
AEGetParamDesc to get the descriptor record of a parameter, or you can use AEGetParamPtr to get the data out of the descriptor record of a parameter. Attributes are also keyword-specified descriptor records, and you
can use similar routines to get the descriptor record of an attribute or to get
the data out of an attribute.