I got how to SendMessage to another process. Now I am trying to understand how to receive the message on my other process. I know how to extract my items from de COPYDATASTRUCTURE but what is the method that is called on my other process. I found a lot of stuff on how to read the received data but never how to implement it. So basically, what function/event is called when an application receives a message from SendMessage()? You must know here that I have full control on both process.
Asked
Active
Viewed 2,391 times
0
-
What kind of application are you developing ? Dialog based, MDI, SDI ? – csanchez Nov 19 '12 at 17:44
-
I am working on a dialog based application using MFC, I explain what it does here http://stackoverflow.com/questions/13455475/how-to-send-a-byte-array-to-another-process-in-c – Jean-François Deschênes Nov 19 '12 at 18:03
-
1Have you seen this example ? http://www.codeproject.com/Articles/115/Inter-Process-Communication-using-WM_COPYDATA – csanchez Nov 19 '12 at 18:19
2 Answers
0
The send message from another process is exactly like any send message received from the same process: Specifically the window procedure for the window the message is sent to is called with the message as parameters just as you would receive a WM_PAINT or any other op-sys message.

Elemental
- 7,365
- 2
- 28
- 33
-
So I just have to declare a function like LRESULT CALLBACK MainWndProc(HWND hwnd,UINT uMsg,WPARAM wParam,LPARAM lParam) and that function will be triggered when receiving a message am I right? – Jean-François Deschênes Nov 19 '12 at 15:45
0
Consider reading this blog post, containing sample code:
Using WM_COPYDATA to marshal message parameters since the window manager otherwise doesn't know how
(You simply handle WM_COPYDATA
in the receiver WndProc
.)

Mr.C64
- 41,637
- 14
- 86
- 162