What Is Dynamic Data Exchange? (Definition Plus Uses)

By Indeed Editorial Team

Published 27 April 2022

The Indeed Editorial Team comprises a diverse and talented team of writers, researchers and subject matter experts equipped with Indeed's data and insights to deliver useful tips to help guide your career journey.

Programmers may recognise Dynamic Data Exchange (DDE) as pioneers of communication between applications. Microsoft developed it and was mainly used to send messages between Microsoft Office programs. Understanding what a DDE is can help you lay a strong foundation for your programming career. In this article, we explain what a DDE is, discuss its uses, analyse its messages, explore its message flow process and list major DDE terminologies.

What is Dynamic Data Exchange?

Dynamic Data Exchange, also known as inter-process communication, is a message-driven Microsoft computer protocol that allows data sharing between Windows applications. It sends messages to form a communication channel between the program requesting data, the client and the application storing the data.

A DDE request comprises the server's DDE application name, the nature of the data to be exchanged (the DDE topic) and the DDE item name. You can run DDE links once or periodically, in which case the system notifies the receiving application whenever the value of the supplied data on the server changes. A single application can establish many DDE links and act as both a client and a server simultaneously.

Related: What Does a Computer Programmer Do? (With Career Steps)

What does Dynamic Data Exchange do?

DDE uses shared memory to exchange data between apps by sharing data and sending messages. It works by sending messages with the DDE request to all other currently active programs. If a running program acknowledges the DDE request, it responds and starts a dialogue. The Windows operating system then creates a connection between the two programs. When the client application requires updated data regularly, communication routes can be one-time-only or permanent.

What is DDE used for?

You can use DDEs for data exchanges that don't demand continuous user interaction. Applications usually allow the user to create a link between the data-exchanging applications. Once the DDE forms link, the programs can share data without further user interaction. Some application features that may use DDEs include:

  • Operating off-the-shelf software through custom-developed apps: By starting a DDE conversation with Excel and delivering it DDE commands, a customised in-house application may, for example, open a Microsoft Excel spreadsheet and load it with data.

  • Applying a wide range of application functionalities: Some functions may include real-time data integration for stock market updates, scientific equipment and process control.

  • Compounding documents: For example, a word processor document that has a chart generated by a graphics program. DDE changes the information on the chart when you change the source data, but the rest of the text remains unchanged.

You may find it easy-to-use DDE because it doesn't use particular libraries or functions, as it's a message-based protocol. You can execute all DDE transactions by sending specific DDE messages repeatedly between the two applications. The DDE header file defines the symbolic constants for each of the DDE messages. It also represents the structures for the various DDE messages. The following are the nine DDE messages and their definitions:

  • WM_DDE_ADVISE: When a data item changes, it requests the server application to provide an update or notification, creating a permanent data relationship.

  • WM_DDE_ACK: The system sends this message to the client software to show that the server application completed the message command successfully. If the command fails, it sends a negative WM_DDE_ACK, containing an error code describing the failure.

  • WM_DDE_INITIATE: It starts a conversation between the client and server applications. The client may send the message to every data object or tool they want to communicate.

  • WM_DDE_TERMINATE: It ends a conversation. The client can send this message and accept a WM_DDE_TERMINATE from the system.

  • WM_DDE_POKE: The client sends it to change the data item value. The message carries new weight for the item, and the workstation changes the data item value to the new one after receiving it.

  • WM_DDE_UNADVISE: It ends an existing permanent data link.

  • WM_DDE_REQUEST: The client sends it to get the data item value within a conversation. You can request the data item value by name because every topic has several data items linked to it.

  • WM_DDE_EXECUTE: The client sends it to the server to activate the operation you want to perform. The message may be a string that the server processes as a string of commands.

  • WM_DDE_DATA: It sends a data item value to the server application.

Related: What Does It Take to Be a Software Engineer?

How the DDE message flow works

The following process occurs during a Dynamic Data Exchange message flow:

Start the conversation and exchange data

The client program starts the conversation by sending a message to the server application. It may use the statement to request data from the server application. Upon receiving the message, the server application responds. DDE clients can start a conversation with a tool or object window, regardless of whether the user has activated the associated window. If you've already opened an interactive window, the initiation request may create a dialogue with it. Otherwise, the system may activate the item before communication with the client application begins. The two applications can exchange data using any of the following methods:

  • the server application sends data to the client application on request

  • the client application requests that the server application alert it whenever a data item changes

  • the client application sends data to the server application without request

  • the client application invites the server application to send data whenever a data change occurs

  • the server application executes a command at the client application's request

End the conversation

After exchanging data, the client or server application can end the conversation. If the client had opened it when the interaction started, the window associated with it is closed. If the user had started the window interactively and was already present when the conversation began, it may continue to be present even after the client ends the program.

Related: What Does a PLC Programmer Do? (Plus Skills and Salaries)

Important DDE terminologies

The following are some major DDE concepts:

The client application, server application and conversation

A DDE conversation is a communication between two DDE-enabled applications. The DDE client application starts the interaction while the DDE server application responds to the client. An application can participate in multiple conversations simultaneously, acting as both the client and the server. A DDE conversation may occur between two windows, one for each program involved. A window can be the application's primary window, a window connected to a document known as a MDI application or an invisible window whose only function is to handle DDE messages.

System topic

Applications always support the system topic. The topic holds data that may interest another program. You can use the CF TEXT clipboard format to produce data-item values. Tab characters separate individual elements of item values for a system topic.

Application, item names and topic

The DDE protocol uses a three-level hierarchy of application, subject names to identify the data units transferred between the client and server. Each DDE chat has a unique application name and topic. The client and server determine the name and subject at the start of a DDE interaction. The name of the application can match the name of the server application. For example, if Excel serves as the server in a chat, the program's name is Excel.

The DDE topic is a broad data category that allows you to exchange several data pieces simultaneously. It may be a filename for programs that act on file-based content. The user can't change the application name and topic that characterises a DDE conversation during the conversation because the client and server windows together identify a DDE conversation. A DDE data item is information about the conversation topic the applications are exchanging. The system can transfer data item values between the server and the client.

Permanent data links

The client can establish permanent data links with the server after a DDE conversation begins. A data link is a method of communication where the server alerts the client when the value of a specific data item changes. The data link is permanent because the notification process continues until the data link or the DDE dialogue ends.

There are two types of permanent data links, warm and hot. In a warm data link, the server alerts the client that the data item's value has changed, but the user doesn't send it to the client until they request it. In a hot data link, the server immediately delivers the updated data value to the client.

Shared memory objects and atoms

Global atoms or shared memory objects are some arguments of DDE messages. The user may allocate or delete these arguments according to the rules stated in the applications that use them. You may remove atoms or shared memory objects your recipient didn't get because of a mistake.

Please note that none of the companies, institutions or organisations mentioned in this article are affiliated with Indeed.

Explore more articles