I am trying to send data from one app to another using WM_COPYDATA. Both apps are console and have no window. I can send user messages just fine. When I try to send WM_COPYDATA, and setup the data structure or not, I get error 1159, which basically says I have to send using a synchronous message call... yet there is no SendThreadMessage.
It seems this is a oversight in the api or docs? There seems to be no way to use WM_COPYDATA using only threads without windows?
WM_COPYDATA can only be sent and cannot be posted. Because the payload is marshaled between processes, temporary data structures are created to support that marshaling. They need to be destroyed when the message processing is complete. That implies that the message must be delivered synchronously.
All of this means that you cannot use
PostThreadMessage. Instead you will need to create a window to act as the recipient of such messages. Note that this window can be a message-only window and does not need to be visible.