|
Dynamic Data Exchange is a feature of Windows
that allows two programs to share data or send commands directly to each
other. DDE can be
thought of as a direct conversation between two application programs. In
most cases, one
application is providing some form of data (either text or graphics) to another
application. The application that is the source of the data is called the
"server" and the application that is receiving the data is called
the "client". (WinWedge is primarily a DDE Server that "serves" incoming
serial data to other programs).
Each data item that a server application can provide has a unique identifier
consisting of three parts, a DDE Application Name, a DDE Topic, and a DDE Item
Name.
The DDE Application Name is almost always the executable filename for the server
application (without the .EXE extension). The DDE Topic typically identifies
a group or category of data in the server application and each data item that
a server can provide has a unique DDE Item Name. Thus, the Application Name,
Topic, and Item Name identify the exact source of the data in a server application
that is to be linked. (Similar to a telephone number with the three parts: Area
Code, Exchange and Number.)
DDE links are always initiated in the client application. The client initiates
a DDE link by broadcasting a message containing a DDE Application Name, A DDE
Topic, and optionally a DDE Item to all other applications currently running.
If a server application is running that can provide the data, it responds to
the "DDE initiate" and the Windows operating system opens a "link" between
the two applications. Fortunately, most Windows programs that support DDE insulate
the user from the low level details of establishing DDE links and simply allow
you to specify the Application Name, Topic, and Item Name for a specific piece
of data and the link is then automatically established for you by your application
program.
For example, if you enter the formula: =WinWedge|Com1!'Field(1)' in a cell in
an Excel spreadsheet and then press the Enter key, Excel will automatically establish
a DDE link between WinWedge and the spreadsheet cell. (Note: WinWedge must be
running and activated for COM1 in order for the above link formula to be successful).
After the link is established, any data in the text box "Field(1)" in
WinWedge window will automatically appear in the "linked" cell in the
spreadsheet. Also, whenever the data for Field(1) in the Wedge changes, the contents
of the spreadsheet cell will automatically be updated with the new data. It is
like having the operating system do an automatic cut & paste from the server
to the client whenever the server's data changes. The formula: =WinWedge|Com1!'Field(1)'
contains the three parts necessary to successfully link to WinWedge: the DDE
Application Name (WinWedge), the DDE Topic (Com1) and the specific DDE Item Name
'Field(1)'.
Either application involved in a DDE conversation can terminate the link. Some
applications have menu options that allow you to selectively terminate any open
DDE links. Closing either of the linked applications also causes all links between
the two programs to be terminated.
DDE also allows a client application to send commands to a server. The types
of DDE commands, if any, that a server program can accept will vary depending
on the application and should be well documented in the application's user's
manual along with the DDE Application Name and Topic required by client programs
to establish the DDE link to the servers command processor. WinWedge supports
over three dozen DDE commands that allow other applications to control the Wedge
or transmit data out a serial port. All of these commands are described in detail
in WinWedge users manual or the on-line help.
|