Using the DDE Server part
Let's discuss some of the fundamentals of DDE before building the application.
DDE server applications use DDE to broadcast data to one or more applications that have registered an interest in the data the server can provide. DDE client applications are the applications that receive data from the server.
DDE provides a two-way communication capability that also enables a client to send data to a server. This sometimes causes confusion. Just keep in mind that a DDE server can send data to multiple clients, but a DDE client can send data to only one server.
Creating the window
To get familiar with DDE, let's build an application that uses both the DDE server part and the DDE client part in the same window.
Create a new visual part named SameWindow consisting of two Label parts and two Text parts. Make it look like the following:
DDE example
You will add a DDE Server part so that text entered in the server text field is sent to any interested DDE clients.
Select the External Functions category, and then select DDE Server icon, the DDE Server part. Now add the part to an open space on the free-form surface.
Specifying the DDE server settings
Open the settings for the DDE Server part. You will see a window that looks like this:
DDE server settings
DDE uses four strings to identify all information to be exchanged. The four strings are Server name, Topic, Item, and Format.
Server name
The name used by client applications to identify the server application. The server name is usually, but not always, the actual name of the server application. For example, the server name for Microsoft Excel is Excel. This name must be unique to avoid name collisions with other servers.
Topic
A logical grouping of the data that a server can provide. The choice of groupings is a decision of the application developer. Examples of topics are stockprices or autoprices.
Item
The name of specific values that the server can provide. Examples of items for the topic stockprices would be IBM or Microsoft.
Format
A keyword that identifies the format or formats in which the data can be provided. An example of a format for stockprices would be string.
Note:
Double-byte characters are not supported for any of these strings.
To complete the settings page, specify samewindow for the Server name, and then select New. Notice that a new row has been added to the table. Specify topic for Topic, item for Item, and string for Format.
Select OK to accept the changes to the settings page.
Making connections to the DDE Server part
Complete the DDE server part by connecting it to the Server Text part. Select Connect > topic_item_string from the DDE Server pop-up menu.
The topic_item_string attribute is the concatenation, separated by underscores, of the Topic, Item, and Format specified in the DDE Server settings page. VA Smalltalk added this to the public interface of the DDE Server part for you.
Complete the connection by connecting the topic_item_string attribute to the Server Text part's object attribute. Now the DDE Server will broadcast the contents of the Server Text part to any interested DDE clients whenever the Text part's object attribute changes. The broadcast will occur with each keystroke, because you accepted the default settings for the text part.
Last modified date: 06/11/2018