# Processing Events

While your program executes in a callback function or in code that does not call RunUserInterface or GetUserEvent, LabWindows/CVI does not process system events, and consequently cannot update the user interface. If a particular function is overly time-consuming, it essentially "locks out" user interface updates. To allow LabWindows/CVI to process these updates, place a call to ProcessDrawEvents in your source code.

Call ProcessSystemEvents to allow LabWindows/CVI to process events beyond user interface updates. Because ProcessSystemEvents can cause other callback functions to execute before it completes, you must use this function with care.

In particular, when ProcessSystemEvents handles an event that starts a tracking loop, such as the user pulling down a menu, ProcessSystemEvents does not return until the tracking loop completes. In the case of pulling down a menu, the tracking loop does not complete until the user dismisses the menu. Consequently, do not call ProcessSystemEvents in your program if you want to continue executing the subsequent lines of code even during a tracking loop.

ProcessSystemEvents processes all pending system events, such as,

- Keystrokes, mouse events, and screen updates.

- Events generated by other applications, for example, Windows messages you receive in callbacks you install with RegisterWinMsgCallback.

LabWindows/CVI processes events automatically when you call GetUserEvent or after a callback returns.