Share via


Overview | Methods | This Package | All Packages

OverviewMethodsThis PackageAll Packages

Application.doEvents

Processes Windows messages currently in the message queue.

Syntax

public static void doEvents()

public static void doEvents( int message )

public static void doEvents( int messageStart**, int** messageEnd )

Parameters

message

The message to process.

messageStart

The starting range for messages to process.

messageEnd

The ending range for messages to process.

Remarks

Warning   Calling the doEvents method disposes of Graphics objects that are defined for a paint event or created using the createGraphics method.

The doEvents method allows for pending Windows messages to be processed. This method is typically used in looping code to allow messages to be processed. Calling the first version of this overloaded method causes all events to be processed. The second version processes only messages that are of type message. This version is useful when you want to allow only certain messages (such as WM_PAINT) to be processed while other messages are left pending. The third version processes only messages in the range starting with messageStart and ending with messageEnd. This version of doEvents is typically used to allow only a narrow range of messages, such as WM_MOUSEFIRST to WM_MOUSELAST, to be processed.

Note   Care must be taken when calling this method because it can cause code to be re-entered if a message causes an event to be triggered.