Line-by-line Anatomy of Hello.c (Cont.)


EvtGetEvent( &event, evtWaitForever );
An event is a software message that indicates something has happened. The function void EvtGetEvent( EventType *event, Int32 timeout ) returns the next available event. Pass evtWaitForever as the timeout in most instances. When running on the device, this makes the CPU go into doze mode until the user provides input.

SysHandleEvent( &event );
The function Boolean SysHandleEvent( EventPtr eventP ) handle defaults for system events such as hard and soft key presses. It returns true if the system handled the event. Applications should call this routine immediately after calling EvtGetEvent( ).
} while ( event.eType != appStopEvent );
When the system wants to launch a different application than the one currently running, the event manager sends this event to request the current application to terminate by using the event reference appStopEvent. In response, an application has to exit its event loop, close any open files and forms, and exit.