22.3 Dynamic-Data-Exchange Messages

Because DDE is a message-based protocol, it employs no special Windows functions or libraries. All DDE transactions are conducted by passing certain defined DDE messages between the client and server windows.

There are nine DDE messages; the symbolic constants for these messages are defined in the Microsoft Windows 3.1 Software Development Kit (SDK) header file DDE.H, not WINDOWS.H. Certain data structures for the various DDE messages are also defined in DDE.H.

The nine DDE messages are summarized as follows. For a detailed description of each DDE message, see the Microsoft Windows Programmer's Reference, Volume 3.

Message Description

WM_DDE_ACK Acknowledges receiving or not receiving a message.
WM_DDE_ADVISE Requests the server application to supply an update or notification for a data item whenever it changes. This establishes a permanent data link.
WM_DDE_DATA Sends a data-item value to the client application.
WM_DDE_EXECUTE Sends a string to the server application, which is expected to process it as a series of commands.
WM_DDE_INITIATE Initiates a conversation between the client and server applications.
WM_DDE_POKE Sends a data-item value to the server application.
WM_DDE_REQUEST Requests the server application to provide the value of a data item.
WM_DDE_TERMINATE Terminates a conversation.
WM_DDE_UNADVISE Terminates a permanent data link.

An application calls the SendMessage function to issue the WM_DDE_INITIATE message or a WM_DDE_ACK message sent in response to WM_DDE_INITIATE. All other messages are sent by the PostMessage function. The window handle of the receiving window appears as the first parameter of these calls. The second parameter contains the message to be sent, the third parameter identifies the sending window, and the fourth parameter contains the message-specific arguments.