Important Notice
The pages on this site contain documentation for very old MS-DOS software,
purely for historical purposes.
If you're looking for up-to-date documentation, particularly for programming,
you should not rely on the information found here, as it will be woefully
out of date.
About Dynamic Data Exchange (1.2)
◄Using Section► ◄Function Group► ◄Message Group► ◄Up► ◄Next► ◄Previous►
────────────────────────────────────────────────────────────────────────────
About Dynamic Data Exchange
This topic describes how to use dynamic data exchange (DDE) messages to
transfer data between programs. You should also be familiar with the
following topics:
◄Messages and message queues►
◄Memory manager►
◄Clipboard►
The dynamic data exchange (DDE) protocol is a set of messages and guidelines
that allow MS OS/2 Presentation Manager applications to share data freely,
using either one-time data transfers or ongoing exchanges, in which
applications send updates to one another as new data becomes available.
The DDE protocol uses messages for signaling between applications that share
data. The DDE protocol uses shared memory as the means of transferring data
from application to application. DDE defines some structures to store the
shared memory objects.
DDE is different from the clipboard data-transfer mechanism that is also
part of MS OS/2. One difference is that the clipboard is almost always used
as a one-time response to a specific action by the user──such as choosing
"Paste" from a menu. DDE, on the other hand, is often initiated by a user
but typically continues without the user's further involvement.
Client and Server Interaction
DDE transactions always consist of a client application and a server
application. The client initiates the exchange by requesting data from the
server. The server responds to the data requests by providing data to the
client. A server can have many clients at the same time, and a client can
request data from multiple servers.
An application can be both a client and a server. For instance, an
application might receive data from another application as a client, and
then act as a server by passing the data to another application.
The important distinction between a client and a server is that the client
initiates the DDE transaction.
Sample DDE Relationship
There are many potential uses of DDE in real-time data-acquisition
applications. This section discusses an example of one such use: a DDE-based
real-time system for tracking portfolios. Two hypothetical Presentation
Manager applications cooperate in this example. One application, named
"Collector," is a specialized interface that draws data from an on-line data
service. The other application is a spreadsheet. Both applications use the
DDE protocol. In the described exchanges the spreadsheet application is the
client──that is, the application that initiates DDE transactions──and the
on-line data-collection application is the server.
The sample spreadsheet has the following layout:
A B C D
1 Stock Shares Price Extension
2 BTRX 1000 148 148000
3 HLOW 2000 26 52000
4 WRLD 200 24 4800
5 ZMXI 2000 93 186000
6 390800
Without DDE, this spreadsheet could be updated by using the clipboard to
manually copy numbers from the screen display of the Collector application
into the spreadsheet. This would require screen sharing or switching between
applications, and would also require that the user pay attention to the
price data and personally undertake the data exchange.
With DDE, this system could be much more automatic, providing the
spreadsheet with the current values for multiple data items without
intervention by the user. DDE would allow the user to set up an exchange
between the server and client applications that would keep the spreadsheet
up-to-date whenever a change occurred in the value of specified stocks. Once
this connection was established, the cell values in the spreadsheet would
always reflect the most current data available from the server. This system
would facilitate the timely analysis of real-time data.
The usefulness of the DDE protocol is not restricted to specialized
real-time data-acquisition applications. Productivity software in general
can benefit significantly from the protocol. For example, suppose a monthly
report is prepared using a graphics-and-text word processor, and that the
report includes graphs generated in a separate business-graphics package.
Without DDE, it would be necessary to manually copy and paste each month's
new graphs into each month's report. With DDE, the word processor can
establish a permanent link to the charting application, so that any changes
made by the user to the charting document are reflected in the
word-processing document, either automatically or on request. This makes the
routine of document preparation much simpler for the user.
♦