Carbon


AEGetEventHandler

Header: AppleEvents.h Carbon status: Supported

Gets an event handler from an Apple event dispatch table.

OSErr AEGetEventHandler (
    AEEventClass theAEEventClass, 
    AEEventID theAEEventID, 
    AEEventHandlerUPP *handler, 
    SInt32 *handlerRefcon, 
    Boolean isSysHandler
);
Parameter descriptions
theAEEventClass

The event class for the desired handler.

theAEEventID

The event ID for the desired handler.

handler

A universal procedure pointer. On return, a pointer to the specified handler, if a dispatch table entry exists that exactly matches the values supplied in the parameters theAEEventClass and theAEEventID.

If you use the typeWildCard constant for either or both of these parameters, AEGetEventHandler will return an error unless an entry exists that specifies typeWildCard in exactly the same way. For example, if you specify typeWildCard in both the theAEEventClass parameter and the theAEEventID parameter, the Apple Event Manager will not return the first handler for any event class and event ID in the dispatch table; instead, it will only return a handler if an entry exists that specifies type typeWildCard for both the event class and the event ID.

For an explanation of wildcard values, see the Discussion section for AEInstallEventHandler.

handlerRefcon

A pointer to a reference constant. On return, the reference constant from the dispatch table entry for the specified handler. The reference constant may have a value of 0.

isSysHandler

Specifies the Apple event dispatch table to get the handler from. Pass TRUE to get the handler from the system dispatch table or FALSE to get the handler from your application’s dispatch table. See Platform Considerations for related information.

function result

A result code.

VERSION NOTES

A Carbon application should not install a handler in a system dispatch table with the goal that the handler will get called when other applications receive events—this won’t necessarily work. See “Apple Event Dispatching” (to be supplied later) for more information.

AVAILABILITY

Supported in Carbon. Available in Carbon 1.0.2 and later when running Mac OS 8.1 or later.


© 2000 Apple Computer, Inc. (Last Updated 6/30/2000)