The Simple Way to Pass Data Between Processes

Did you know there is a simple way to pass data between processes? Simply use SendMessage to send a WM_COPYDATA message to another process (or course, you have to have a window handle).

This message allows you to pass a 32-bit value, a length, and a pointer to a block of memory (of the correct length, of course). Windows will translate the pointer so that the receiving program can read the block of data. Of course, the address will change, so don't put addresses (like pointers) in the address block.

It is simple to catch this message with ON_WM_COPYDATA in your message map (use Class Wizard).