I understand that when a message is sent, it has hwnd value so that the systems knows which window is responsible for dealing with that message. And when hwnd is NULL then it means that this is a thread message. So what is the procedure function that is called to deal with that message?
Share
Note that it is only documented under PostMessage (not SendMessage) that sending with
HWNDasNULLwill cause the function to “behave like PostThreadMessage with dwThreadId as the current thread”.See here for how a thread can implement a message queue.
In response to your original question:
PostThreadMessage posts to the message queue of the thread.
Note for PostThreadMessage: “The function fails if the specified thread does not have a message queue. The system creates a thread’s message queue when the thread makes its first call to one of the User or GDI functions.”