Message Queuing belongs to the thread, and the post message is to put the message in the message queue of the target thread.
The difference between the two is:
PostMessage determines the target thread by specifying the target window handle, which is typically handled by the window procedure;
PostThreadMessage directly specifies the target thread ID to determine the target thread, there is no target window, and can only be processed directly in the message loop according to the message type.
In terms of the selection of the programming, if it is a UI thread, you should use PostMessage, or if it is a worker thread, you should use PostThreadMessage and do not create a window to receive the message.
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
The difference between PostMessage and PostThreadMessage