In Dynamic Data Exchange (DDE), interprocess communication is achieved through DDE clients connecting to DDE servers. A DDE Server registers a DDE Service, which is a name used to identify the server (usually it's the name of the executable program) and then sits waiting for connections. A DDE Client connects to a DDE Server by specifying the server's Service name and a Topic of conversation, which is just another string recognized by the server. If the server accepts the connection, a DDE Conversation is established. Through such conversation, the client can take the initiative and start Client Transactions. There are five types of client transactions: Request, Poke, Execute, StartAdvise, and StopAdvise. Each transaction is a different way to share some data. Except for the execute transaction, the actual data shared is identified by a data Item, which is yet another string defined by the server, and by a data Format. There are some standard formats in Windows (like CF_TEXT for strings, CF_BITMAP for bitmaps), but you can also register your own formats. Execute transactions don't use a data item because they are a way to send a command to the server; you can think of it as if the data item "Command" is implicit in the transaction.
Each of these transactions can be synchronous or asynchronous, and the server can accept or refuse the transaction. In synchronous transactions, the client receives the result of the transaction as the call returns, or the call can return due to a timeout. In asynchronous transactions, the result is going to be sent to the client later as a transaction of a certain type. A transaction type is a type of message sent to a DDE callback, and a DDE callback is a function defined and registered by the application to handle all the events that DDEML sends to its DDE clients and servers.
Client Transaction Types
The five client transaction types are defined as follows:
- Request. This is a request for a specific data item from the server. The server should respond by sending back the data.
- Poke. This is a way to set the value of a data item within the server. The server can accept or refuse the unsolicited data.
- Execute. This is a way to send a set of commands to the server, each command with its own parameters. The format of these commands should follow a standard. See the MSDN article "DDE Execute Strings" for more information.
- StartAdvise. This is a way to tell the server that the client wants to be notified when a specific data item changes. If the transaction succeeds, the server will send the client a notification (warm link) or the data itself (hot link) each time the data changes, until the client stops the advise link or the conversation is terminated.
- StopAdvise. This is the way to tell the server to stop informing the client when the specific data item changes.
The client can start any number of transactions in its active conversation, including any number of advise links on different data items. But the client cannot start a synchronous transaction while another synchronous transaction is waiting to complete (reentrancy error).