IPC with WM_COPYDATA
Inter-process communications (IPC) in Windows can be accomplished in a variety of ways. Essentially these different implementations boil down to just 2 types: local and network based IPC. Local implementations like COM and WM_COPYDATA are all just forms of passing data with memory mapped files. Setting up a custom memory mapped file mechanism can be rather involved, and creating COM applications for a simple IPC operation between two applications can result in a bit of code and registration hassles.
This is where WM_COPYDATA can provide a quick IPC link between two applications. It really makes sense when the messages occur between the application windows themselves, but even that isn't a requirement. Here is an example where a request is sent to a server application by first finding the window handle of the server process and sending the data via a WM_COPYDATA message along with a handle to a window that will process any response, which occurs before the original SendMessage returns in this case. The code below would even work from multiple threads.
The window procedure processing the response would look something like this:
(TCHAR and _tcs functions are macros for MBCS/Unicode compatibility)