wm-copydata

Thread message loop for a thread with a hidden window?

廉价感情. 提交于 2019-12-03 15:58:31
I have a Delphi 6 application that has a thread dedicated to communicating with a foreign application that uses SendMessage() and WM_COPYDATA messages to interface with external programs. Therefore, I create a hidden window with AllocateHWND() to service that need since a thread message queue won't work due to the SendMessage() function only accepting window handles, not thread IDs. What I'm not sure about is what to put in the thread Execute() method. I assume that if I use a GetMessage() loop or a create a loop with a WaitFor*() function call in it that the thread will block and therefore

C# to C++ process with WM_COPYDATA passing struct with strings

ⅰ亾dé卋堺 提交于 2019-12-03 12:04:35
From a c# program I want to use WM_COPYDATA with SendMessage to communicate with a legacy c++/cli MFC application. I want to pass a managed struct containing string objects. I can find the handle to the c++ application for use with SendMessage fine. The bit I don't know about is how the struct and it's strings can be marshalled and read at the other end. Especially as it contains non-blittables. Do people think this is feasible? I'll continue to work on it, but would apprecite someone who's done this sort of thing telling me if it just isn't going to work. Here is some demo code if it was a c+

Use WM_COPYDATA to send data between processes

孤街醉人 提交于 2019-11-27 01:35:48
I wish to send text between processes. I have found lots of examples of this but none that I can get working. Here is what I have so far: for the sending part: COPYDATASTRUCT CDS; CDS.dwData = 1; CDS.cbData = 8; CDS.lpData = NULL; SendMessage(hwnd, WM_COPYDATA , (WPARAM)hwnd, (LPARAM) (LPVOID) &CDS); the receiving part: case WM_COPYDATA: COPYDATASTRUCT* cds = (COPYDATASTRUCT*) lParam; I dont know how to construct the COPYDATASTRUCT, I have just put something in that seems to work. When debugging the WM_COPYDATA case is executed, but again I dont know what to do with the COPYDATASTRUCT. I would

Use WM_COPYDATA to send data between processes

岁酱吖の 提交于 2019-11-26 09:39:53
问题 I wish to send text between processes. I have found lots of examples of this but none that I can get working. Here is what I have so far: for the sending part: COPYDATASTRUCT CDS; CDS.dwData = 1; CDS.cbData = 8; CDS.lpData = NULL; SendMessage(hwnd, WM_COPYDATA , (WPARAM)hwnd, (LPARAM) (LPVOID) &CDS); the receiving part: case WM_COPYDATA: COPYDATASTRUCT* cds = (COPYDATASTRUCT*) lParam; I dont know how to construct the COPYDATASTRUCT, I have just put something in that seems to work. When