How the Windows Message System Works

A Windows application's message system has three key components:

  • Message queue—Windows maintains a message queue for each application. A Windows application must get messages from this queue and dispatch them to the proper windows.

  • Message loop—This is the loop mechanism in a Windows program that fetches a message from the application queue and dispatches it to the appropriate window, fetches the next message, dispatches it to the appropriate window, and so on.

  • Window procedure—Each window in your application has a window procedure that receives each of the messages passed to it by the message loop. The window procedure's job is to take each window message and respond to it accordingly. A window procedure is ...

Get Borland® Delphi™ 6 Developer's Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.