Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

Previous Book Contents Book Index Next

Inside Macintosh: Macintosh Toolbox Essentials /
Chapter 2 - Event Manager / Event Manager Reference
Event Manager Routines / Sending Events


PPostEvent

In most cases your application does not need to post events in the Operating System event queue; however, if you must do so, you can use the PPostEvent function.

FUNCTION PPostEvent (eventCode: Integer; eventMsg: LongInt;
                     VAR qEl: EvQElPtr): OSErr;
eventCode
A value that indicates the type of event to post into the Operating System event queue. The types of events that can be posted in this queue are represented by these constants: mouseDown, mouseUp, keyDown, keyUp, autoKey, and diskEvt. Do not attempt to post any other type of event in the Operating System event queue.
eventMsg
A long integer that contains the contents of the message field for the event that PPostEvent should post in the queue.
qEl
PPostEvent returns a pointer to the event queue entry of the posted event in this parameter.
DESCRIPTION
In the eventCode and eventMsg parameters, you specify the value for the what and message fields of the event's event record. The PPostEvent function fills out the when, where, and modifiers fields of the event record with the current time, current mouse location, and current state of the modifier keys and mouse button.

The PPostEvent function returns a pointer to the event queue entry of the posted event in the qEl parameter. You can change any fields of the posted event by changing the fields of its event queue entry. For example, you can change the posted event's modifier keys by changing the value of the evtQModifiers field of the event queue entry.

The PPostEvent function posts only events that are enabled by the system event mask. If the event queue is full, PPostEvent removes the oldest event in the queue and posts the new event.

WARNING
Do not post any events other than mouse-down, mouse-up, key-down, key-up, auto-key, and disk-inserted events in the Operating System event queue. Attempting to post other events into the Operating
System event queue interferes with the internal operation of the
Event Manager.
ASSEMBLY-LANGUAGE INFORMATION
You must set up register A0 and register D0 before invoking PPostEvent. The PPostEvent function returns values in registers A0 and D0.
Registers on entry
A0Event number (low-order word)
D0Event message (long)
Registers on exit
A0Pointer to an event queue entry (long)
D0Result code (low-order word)

RESULT CODES
evtNotEnb1Event type not valid--event not posted
noErr0No error
SEE ALSO
For a description of the entries in the event queue, see "The Event Queue" on page 2-83.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
11 JUL 1996