Decodes a Mach message and converts it into an Apple event and its related reply.


OSStatus AEDecodeMessage(mach_msg_header_t *header, AppleEvent *event, AppleEvent *reply);



A pointer to a Mach message header for the event to be decoded.


A pointer to a null Apple event descriptor (one with descriptor type typeNull). On successful completion, contains the decoded Apple event. If the function returns successfully, your application should call the AEDisposeDesc function to dispose of the resulting descriptor after it has finished using it.


A pointer to a null Apple event descriptor. On successful completion, contains the reply event from the decoded Apple event. To send the reply, you use the following:

AESendMessage(reply, NULL, kAENoReply, kAEDefaultTimeout);

Return Value

A result code. See Result Codes.


The Apple Event Manager provides the following functions (in macOS only) for working with Apple events at a lower level: AEGetRegisteredMachPort, AEDecodeMessage, AESendMessage, and AEProcessMessage. See the descriptions for those functions for more information on when you might use them.

See Also

Working With Lower Level Apple Event Functions


Returns the Mach port (in the form of a mach_port_t) that was registered with the bootstrap server for this process.


Sends an AppleEvent to a target process without some of the overhead required by AESend.


Decodes and dispatches a low level Mach message event to an event handler, including packaging and returning the reply to the sender.