Sharing memory between app (Retrieving info using messages)

In article <5ilj2d$> "Joe C. Hecht" <> writes:

>Take a look at the WM_COPYDATA data message. I would also recommend
>looking into using OLE, and as a last resort DDE.

Especially with NT, it is critical that you (a) place the information into
shared memory; and (b) ensure that the information is not disposed of by
anyone before the right process removes it.

Generally speaking, I design such apps so that messages provide only a
notification to the other task that it there's data waiting to be picked up.  
The task, upon receipt of the message, must acquire the proper semaphore,
dequeue the message (placing the empty message-block back on a free-list to be
recycled), copy it into its own address-space and release the semaphore.

What I'm trying hard to avoid here is any message that's floating around
pointing to a block of memory that's also floating around, with the whole
thing being asynchronous and hope-it-works.  The key reason why I go to the
extra trouble is largely for debugging.  The situation that happens, be it
right or wrong, has to be reproducible.