DOEVENTS Command
Executes all pending Windows events.
Note You can no longer call DOEVENTS using parentheses (()), for example,
DOEVENTS( )
.
You can use DOEVENTS for simple tasks such as making it possible for the user to cancel a process after it starts, for example, searching for a file. Long-running processes that yield control of the processor are better performed using a Timer control or delegating the task to an ActiveX executable (.exe) component. In this situation, the task can continue independently of your application, and the operating system takes care of multitasking and time allocation.
Caution Any time you temporarily yield control of the processor in an event procedure, make sure the procedure is not run again from a different part of code before the first call ends. Doing so might cause unpredictable results. In addition, do not use DOEVENTS if other applications might interact with your procedure in unforeseen ways during the time you have yielded control of the processor.
DOEVENTS [FORCE]
Parameters
FORCE
Pauses Visual FoxPro code execution until a Windows event occurs, such as moving the mouse.Note Using the FORCE keyword can impact performance. Therefore, use caution when calling
DOEVENTS FORCE
in a tight code loop, such as a DO WHILE loop.
Remarks
When the AutoYield property is set to False (.F.), and program code is executing, Window events are placed in a queue. DOEVENTS executes all pending Windows events and processes any user code associated with the Windows events. If no events are in the queue, Visual FoxPro disregards DOEVENTS and continues program execution.