22.2.4 Atoms and Shared Memory Objects

Certain arguments of DDE messages are global atoms. Applications using these atoms must follow explicit rules about when to to allocate and delete these atoms. In all cases, the sender of a message must delete any atom which the intended receiver will not receive due to an error condition, such as failure of the PostMessage function.

DDE uses shared memory objects for three purposes:

To carry a data item value to be exchanged. This is an item referenced by the hData argument in the WM_DDE_DATA and WM_DDE_POKE messages.

To carry options in a message. This is an item referenced by the hOptions argument in a WM_DDE_ADVISE message.

To carry an execution-command string. This is an item referenced by the hCommands argument in the WM_DDE_EXECUTE message and its corresponding WM_DDE_ACK message.

Applications that receive a DDE shared memory object must treat it as read only. It must not be used as a mutual read-write area for the free exchange of data.

As with a DDE atom, a shared memory object should be freed properly to provide for effective memory management. Shared memory objects should be properly locked and unlocked. In all cases, the sender of a message must delete any shared memory object which the intended receiver will not receive due to an error condition, such as failure of the PostMessage function.

For information about how the DDE messages allocate and delete atoms and shared memory objects, see the Microsoft Windows Programmer's Reference, Volume 3.