Definitive Guide: What Is the Dynamic Data Exchange?
By Indeed Editorial Team
Published April 8, 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.
When working with systems operating under Windows, programmers or developers might want to transfer data from one device to another. These professionals can use the Dynamic Data Exchange protocol to move data between applications easily. If you're a developer or programmer who uses Windows, then it might benefit you to learn about the Dynamic Data Exchange protocol to improve your skills and knowledge. In this article, we discuss the Dynamic Data Exchange, explain how it works and provide six steps to use this protocol with Windows.
What is the Dynamic Data Exchange protocol?
The Dynamic Data Exchange (DDE) protocol is a message-based system that allows you to transfer data from one application to another. Windows developed this protocol, which means the applications must be on other Windows systems for the method to work. The DDE protocol creates a conversation between the two applications. The first system requests information from the second system. In the DDE protocol, the system that requests information is called the client and the system that has the data is called the server. The DDE protocol uses a shared memory to transfer data between the two programs.
How does the Dynamic Data Exchange work?
The Dynamic Data Exchange works based on the two applications' shared memory, which is a memory that you can access simultaneously on different devices. This protocol is a client and server model, meaning that one application requests data from the other system. The DDE broadcasts messages that contain requests for running applications. If a running application accepts the request, it creates a conversation. Then, Windows determines a link between the systems. This allows the applications to complete a data exchange. There are several uses for the DDE, such as linking to real-time data, making compound documents or completing data queries.
How to use the Dynamic Data Exchange with Windows
Here are six steps to use the Dynamic Data Exchange with Windows:
1. Starting a conversation
The first step to implementing a DDE is to start a conversation between two applications. To do this, you program the system that's the client to send a "WM_DDE_INITIATE" message. Set the client to broadcast this message by using "SendMessage" as the first parameter. Once you complete this, the client prepares for the application and topic name by calling "GlobalAddAtom." You can set the client to request conversations with any server application or topic by using "NULL" atoms. Once the "SendMessage" call comes back, the client removes the global atoms.
2. Retrieving an item
After you start the DDE conversation, the client can retrieve data from a server through the "WM_DDE-REQUEST" message. To achieve this, you send the message and specify which item and format you'd like to receive. When completing this method, the server usually deletes the item atom. In some situations, this doesn't work, causing the client to delete the atom instead. The server can render the item in the requested format if it has access to the item, which allows the server to copy the items as a shared memory object. This allows you to retrieve an item from the server.
3. Sending an item
Another way you can transfer a single item is by sending the data to the server. You can achieve this by sending a "WM_DDE_POKE" message. In doing this, the client renders the data and sends the "WM_DDE_POKE" message. This message is similar to the "WM_DDE_DATA" message. However, the client sends the "WM_DDE_POKE" message to the server.
When the server accepts the data from the clients, it analyzes the information. If it accepts the data as appropriate, the server sends the clients a positive "WM_DDE_ACK" message. If the server cannot analyze the data, it sends the client a negative "WM_DDE_ACK" message. When this occurs, the client has to free the memory by sending a "WM_DDE_POKE" message with a negative acknowledgment.
4. Setting a permanent data link
Next, set a permanent data link to the data you're transferring in a server application. Once you establish this link, the server creates recurring updates of the link to the client. Usually, the server sends these updates when the data changes. Once you've set a permanent data link, the data stream stays in place until you disconnect it. To establish a data link, have your client send a "WM_DDE_ADVISE" message. After the server accepts this message, it sends a positive "WM_DDE_ACL" message to the client. Now, the server sends new data to the client every time the data changes.
5. Completing commands
You can use the DDE to complete various commands between the two applications. To do this, the programs send the "WM_DDE_EXECUTE" message. This message should contain the commend you'd like to implement. Once the device completes the command, the server sends the client a positive "WM_DDE_ACK" message. If it fails, the server sends a negative message. Typically, you only send one command at a time, meaning you send a message only after you complete the first command. This helps each command to work properly.
6. Deleting a conversation
Once you finish the DDE protocol, you can delete the conversation between the server and the client. Simply have either the server or the client send a "WM_DDE_TERMINATE" message. You can do this any time as long as both applications are prepared to receive the termination message. This helps the process run efficiently with no errors. It's important that you delete all the programs' conversations before turning off the systems. This ensures that no errors occur with the DDE protocol. Once the application is ready to delete, it ends the DDE conversations before processing the "WM_DESTROY" message.
Please note that none of the companies mentioned in this article are affiliated with Indeed.
Explore more articles
- What Is a Sales Budget? Definition, What's Included
- SOAPIE Charting for Stronger Patient Care Documentation
- How To Give Feedback on Communication Skills: 10 Examples
- What Is Brand Image? With Importance, Examples and Tips
- 16 Health Care KPIs: What They Are and Why They're Important
- What Is Construction Planning? Definition, Types and Steps
- Collectivist Work Culture: A Definitive Guide
- The Division of Labor: Advantages and Disadvantages
- Top 12 Job Skills Employers Look for in Job Candidates
- Tall vs. Flat Organizational Structures: Key Differences
- How To Handle a No Call, No Show on Someone's First Day of Work
- Narrow Span of Control: Advantages and Disadvantages