I want to get a working understanding of how message pumping works in the Windows system. I created a console application. I cteated new thread in this aplication:
var thread = new Thread(MessagePump) {IsBackground = true};
_thread.Start();
The message pumping looks like this:
MSG msg;
while (GetMessage(&msg, NULL, 0, 0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
I send messages to this thread using another program. I see that the thread is receiving my messages. I want to understand how this happens. I have not created a window for this thread. According to the instructions, you need a window to receive messages.
The rules for when a thread can receive messages are spelled out:
A window is not needed for a thread to receive messages. As the documentation explains, messages posted to a thread are not associated with a window and follow slightly different rules.