Caution: This version of this document is no longer maintained. For the latest documentation, see


Standard Photon event-handling function


void PtProcessEvent( void );




This function is used primarily for modal-dialog-event handling. If this case, be sure to call PtModalStart() before the event-handling loop, and PtModalEnd() after it.

Note: We recommend using PtModalBlock() and PtModalUnblock() instead of a PtModalStart() / PtProcessEvent() / PtModalEnd() loop. PtModalBlock() makes it easier for you to write modal code that's compatible with multithreaded applications.

If a Photon event is pending, this function processes the event and returns. If no event is pending, or if no work procedure has been defined, the function blocks until an event is received.

Before waiting for an event, this function performs an equivalent of PtLeave(Pt_EVENT_PROCESS_ALLOW). This turns the calling thread into an event reader if it wasn't one already. If you passed the Pt_DELAY_EXIT flag to PtEnter() before calling this function, it will also disable the effect of that flag.

After getting an event, PtProcessEvent() performs an equivalent of PtEnter(0). This means that if another thread called PtExit() while the function was waiting for an event, PtProcessEvent() doesn't invoke any callbacks and will not return.



Interrupt handler No
Signal handler No
Thread No

See also:

PtModalBlock(), PtModalEnd(), PtModalStart(), PtModalUnblock(),

Modal dialogs in the Window Management chapter of the Photon Programmer's Guide