Inside the Windows Messaging System
The messaging system is at the core of the Windows operating system. Without messages, the operating system would be about as useful as a pile of rocks. Subclassing and hooks operate on the messaging system; this is why it is so important to understand messaging as it applies to the Windows operating system. In this section, I will discuss each separate mechanism within the messaging system to give you an idea of how these pieces relate and operate together to send messages from a source to a destination window. Figure 2-4 shows how the messaging system works.

Figure 2-4. The Windows messaging system
The Raw Input Thread
The operating system upon bootup creates one thread for itself, called the raw input thread (RIT). There is only one of this type of thread in the system. This thread contains a system message queue used to receive hardware events such as mouse clicks and keyboard keypresses. It can collect events from these hardware devices through device drivers. A device driver is basically a type of DLL that acts as the translator between the hardware device and the Windows system. This allows hardware devices to communicate with the system. A device driver sits and waits for input from the hardware device for which it is associated. After it gets some type of input, it interrupts the system and sends a hardware event to the system message queue ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access