A Brief Summary of DDE Concepts


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:

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).