0

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.

Community
  • 1
  • 1

2 Answers2

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