Sending Events Between Applications
Sending Events Between Applications
The Macintosh Operating System provides routines that allow your
application to send and receive events using the Apple Event Manager
and Event Manager. The Event Manager provides a general method for
communication between applications. The Apple Event Manager provides a
standard method of communication between applications using the Apple Event
Interprocess Messaging Protocol. (The PPC Toolbox can be used to read and
write low-level message blocks and is more useful for applications that are
closely integrated or perform coordinated tasks.)
Using the Apple Event Manager or Event Manager, applications can send
events to other applications to request services or information. You can send
these events between applications on the same computer or between
applications located on different computers on a network. The
Apple Event Manager uses the services of the Event Manager to send and
receive Apple events. The Event Manager uses the communication services of
the PPC Toolbox on behalf of your application to send and receive events.
For high-level events and Apple events, the applications involved must agree
on what they can ask each other and on the action that should be taken in each
situation. Both the application sending the event and the application receiving
the event must agree on the protocol of communication.
Your application should support at least the required set of Apple events sent
by the Operating System. If you plan to implement publish and subscribe
capabilities, your application should also support the Apple events sent by the
Edition Manager. You can also implement other common Apple events or
design your own customized Apple events. In addition, sets of Apple events exist
for many specific categories of applications (for example, word processors or
spreadsheets).
If your application acts on an Apple event, it should perform the standard
action requested by that event. This helps ensure that other applications (and
eventually users) can send an event to a particular type of application and
expect the other application to understand and act on the event in a standard
way.
In most cases, you should use Apple events to communicate with other
applications. However, if necessary, you can implement your own protocol for
high-level events. The Figure below shows how two applications might use
high-level events. For example, a user might need to update the telephone
numbers of everyone in the marketing department. To accomplish this, the
user might use a word-processing application to send a
high-level event with the new telephone numbers across a network to a
directory application running on a Macintosh computer at the company's
headquarters. When the telephone directory application receives the
high-level event, it updates its directory with the new telephone numbers.
See the Event Manager for information on how to send and receive
high-level events. See the Apple Event Manager for information on the
Apple Event Interprocess Messaging Protocol.
Sending events to other applications