doWindowEvents(waitTime: Integer);
The doWindowEvents method of the Application class processes all queued messages for the application until one of:
The queue is empty and the period in milliseconds specified by the value of the waitTime parameter has expired.
The waitTime period has expired and other callback-type messages (such as timers or notifications) are queued (the first one is always processed). In this case, paint requests and possibly user requests remain unprocessed.
When the doWindowEvents method has processed all pending Windows events, it then waits and processes any further Windows events that arrive until the specified time from when the method was initiated has expired.
You can call the doWindowEvents method from any type of application (for example, from a non-GUI application to allow the processing of timers and notifications) or from a server method.
For example, the doWindowEvents method allows:
Any waiting timer and notification events to be processed.
The Windows environment to respond to other actions; for example, keyboard or mouse clicks.
Do not use the doWindowEvents method in the following situations.
When causing a repaint of a window. Use the
When allowing a Cancel button to be clicked during a lengthy process. Use the
When involved in the processing of ActiveX controls and OLE objects.
As the OLE object processes requests synchronously using Windows events, the Application class doWindowEvents method can cause asynchronous processing to be attempted, with resulting failure.
Call the doWindowEvents method from a server method to process server notifications and timers.
Indiscriminate use of this method can cause unwanted side effects. For example, it can change the order of Windows event processing and can allow users to click on other controls, menus, or forms that could have an impact on the current process.
It can also cause recursive loops. For example, if a
Use of app.doWindowEvents can be dangerous because it can result in recursive calls and can mean events are processed out of order. It is also an expensive operation under thin client mode. Its use should be very restricted and only when the consequences are clearly understood.
The following example shows the use of the doWindowEvents method.
queryUnload(cancel: Integer io; reason: Integer) updating; begin self.endTimer(101); // ticker tape timer app.doWindowEvents(0); if self.bTotalWorth.value then self.endTimer(Graph_Timer); app.doWindowEvents(0); endif; end;
See also the