Jump to content

Event loop

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Gangesmaster (talk | contribs) at 11:53, 13 March 2006. The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)

The event loop is a programming construct that waits for and dispatches events. It works by polling some internal or external "event provider", which generally blocks until an event has arrived, and then calls the relevant event handler ("dispacthes the event").

Windows Applications

The "heart" of most Win32 applications is the WinMain function, which calls GetMessage(), in a loop. GetMessage blocks until a message, or "event", is received. After some optional processing, it will call DispatchMessage(), which dispatches the message to the relevant handler, also known as WindowProc. Normally, messages that have no special WindowProc are dispatched to DefWindowProc, the default one.

See Also