LabWindows/CVI

Content Type
Programming Language
Current manual

ProcessSystemEvents

ProcessSystemEvents

int ProcessSystemEvents (void);

Purpose

When your program executes in a callback function or in code that does not call RunUserInterface or GetUserEvent, LabWindows/CVI does not process user interface and system events. Functions that are overly time-consuming can "lock out" user interface and system events. To allow LabWindows/CVI to process events, call ProcessSystemEvents. Take care when using ProcessSystemEvents, because it can allow other callback functions to execute before it completes.

This function processes all pending events, including the following events:

  • System events that have been delayed or suspended by a user application; for example, keystrokes, mouse events, and screen updates.
  • Events generated by other applications; for example, Windows messages intended to invoke a callback installed with RegisterWinMsgCallback.
Notes   
  • LabWindows/CVI automatically updates the user interface in GetUserEvent or when a callback returns.
  • 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.
  • To increase the speed with which the ProcessSystemEvents function executes, consider calling the SetSleepPolicy function prior to calling the ProcessSystemEvents function. Set the value of the sleepPolicy input of the SetSleepPolicy function to VAL_SLEEP_NONE.

Example Code

The following example code demonstrates how to use this function in a while loop to ensure that LabWindows/CVI processes system events while you run a continuous task. In order to do this, it is important that you break up long, continuous tasks into smaller, discrete steps.

.
.
.

while (!done)

{

ProcessSystemEvents ();

RunAdditionalStep ();

}

.
.
.

Parameters

None.

Return Value

Name Type Description
status int Return value indicating whether the function was successful. A negative number indicates that an error occurred.

Additional Information

Library: User Interface Library

Include file: userint.h

LabWindows/CVI compatibility: LabWindows/CVI 3.0 and later

Example

Refer to userint\DigGraphDAQmx.cws for an example of using the ProcessSystemEvents function.

Was this information helpful?