How Applications are Controlled with DDE
Stages of DDE Conversation
Section titled “Stages of DDE Conversation”There are three stages in a typical DDE conversation between two applications: initiation, transaction, and termination.
Initiation: the Destination (Client) requests a conversation with the Source (Server) by sending a Windows INITIATE message. Windows starts the application if it is not already active. The Source responds to this message by informing the Destination whether or not the requested conversation could be established.
Transaction: The Destination requests desired transactions. The Source then processes these requests. The Destination can send three types of messages.
- REQUEST
- requests a specified data item from the Source.
- EXECUTE
- requests that the Source execute the specified commands.
POKE sends a particular piece of information to the Source.
Termination: At anytime, either the Source or the Destination can end the conversation by sending a Windows TERMINATE message. The other application then answers with a TERMINATE confirmation.
Components of DDE Messages
Section titled “Components of DDE Messages”DDE messages are constructed from three components.
Source Name: A conversation begins when the Destination establishes a conversation with a Source. The Destination must, therefore, know to what name the Source will respond.
The Source name has two components:
- The name used to start the applications
- The name to which it responds through the DDE subsystem.
If these are the same name, you need only give it once. You must establish the proper Source name from the Source application’s documentation. Most applications use some form of their application name as the first part of their Source name, combined with an .exe, .com, .bat, or .pif extension. For example, Microsoft Excel responds to the source name excel.exe.
Topic: A DDE conversation must also have a topic. The topic describes something in the source application that the Destination wants to access. You must establish the topic name(s) required by the Source application. For example, Microsoft Excel recognizes the name of any open document (with the extension) or the SYSTEM topic.
Item: Each DDE request, other than EXECUTE which operates on the application only, must reference an item. The main purpose of this item name is merely to match a Destination request to the proper Source response. The Source dictates the format of an item name, but both Destination request and Source response must reference the same item name. You must establish the type of item names the Source application requires. For example, Microsoft Excel can use a row/column reference (i.e. “R1C1”) as an item.
DDE Source in the Host
Section titled “DDE Source in the Host”Many practical exploitations of VIP Gateway for Windows have been achieved simply by controlling workstation-based applications from host software. This has enabled developers to use the presentation capabilities of any Windows-based product to significantly enhance the functionality of the host application.
However, it is equally simple to create DDE aware host applications that can respond to requests from applications running in the workstation. In this case the host application operates as the Source.
As an example, assume that a Visual Basic, Excel, Word for Windows, or some other DDE-capable process running in the Windows workstation would like to obtain information from files contained on a UNIX host. The workstation product uses standard DDE instructions to send requests to the host environment through VIP Gateway for Windows.
The source process on the host receives and interprets these REQUEST, EXECUTE procedures as specified by the requests, and then returns the information to the destination application.
Successful use of this capability requires the host application developer to correctly interpret the messages that the destination transmits, and have the source process active on the host machine for the appropriate port used by the workstation.
From the Gateway for Windows Reference, version 8.9.1. Open this page in the PDF