Adding Parameters to an Apple Event
parameters to an Apple event. When you use either of these functions, the
Use the AEPutParamPtr function when you want to add data specified in a buffer as the parameter of an Apple event. You specify the Apple event, the
keyword of the parameter to add, the descriptor type, a buffer that contains the
data, and the size of this buffer as parameters to the AEPutParamPtr function. The AEPutParamPtr function creates the descriptor record and adds the parameter to the Apple event.
For example, this code adds a parameter to the Multiply event using the
# define keyOperand1 'OPN1'
long number1;
number1 = 10;
typeLongInteger,& number1, sizeof( number1));
the first number to the specified Apple event.
descriptor record to an Apple event. The descriptor record you specify must
function.
You specify the descriptor type, a buffer that contains the data, and the size of
function returns the descriptor record that describes the data.
This example creates a descriptor record for the second parameter of the
Multiply event:
long number2;
number2 = 8;
myErr = AECreateDesc( typeLongInteger, & number2, sizeof( number2), &multParam2Desc);
In this example, the AECreateDesc function creates a descriptor record with the typeLongInteger descriptor type and the data identified in the number2
variable.
Once you have created a descriptor record, you can use AEPutParamDesc to add the data to a parameter of an Apple event. You specify the Apple event to add
the parameter to, the keyword of the parameter, and the
descriptor record of the parameter as parameters to the AEPutParamDesc function.
This example adds a second parameter to the Multiply event using the
#define keyOperand2 'OPN2'
keyOperand2,&multParam2Desc);
This example adds the keyOperand2 keyword and the descriptor record
created in the previous example as the second parameter to the specified Apple
event.
The previous examples showed how to add parameters to the imaginary
Multiply event. After adding parameters to an Apple event, you can send the
Apple event using the AESend function.