DoEvents (function)

Syntax

DoEvents[()]

Description

Yields control to other applications, returning an Integer 0.

Comments

This statement yields control to the operating system, allowing other applications to process mouse, keyboard, and other messages.

If a SendKeys statement is active, this statement waits until all the keys in the queue have been processed.

Example

The following routine explicitly yields to allow other applications to execute and refresh on a regular basis.

Sub Main()

  Open "test.txt" For Output As #1
  For i = 1 To 10000
    Print #1,"This is a test of the system and such."
    r = DoEvents
  Next i
  MsgBox "The DoEvents return value is: " & r
  Close #1
End Sub

See Also

DoEvents (statement).

More information

D