
                         DDE CLIENT/SERVER
                         =================

Use the dynamic data exchange management library (DDEML) for all new 
development work with DDE.

Note: To see the messages being exchanged in the system, start up the Spy 
application, choose Options, and under Messages, click to deselect all 
check boxes except DDE. Click OK to close the dialog box, and choose the 
All Windows command from the Windows menu.

Starting the client and the server
----------------------------------

First start the client and server applications.

In the client application, choose the Initiate command from the DDE menu 
and complete the Application text box with the name of the server 
application you want to talk to and the topic of the conversation. 
Enter "server" for the server name and "File1" for the topic.

When you click OK, the client sends the WM_DDE_INITIATE message to 
all top-level windows. If a server application supports the specified 
application and topic, it responds to this message by sending the client 
a WM_DDE_ACK message with a handle to the server window. At this point,
a conversation is established. When all applications have responded to 
the client, you can post another message to the server application.

DDE Request message
-------------------

Use the DDE Request message when you want to get information from the 
server only once. Choose the DDE Request command from the client window. 
The Request dialog box displays a list of servers you are currently 
having conversations with. Enter "Item1" in the Item text box. This 
is the item you want to get information on. In the server window, 
type something in the Item1 text box so you can see what is 
returned. When you click the Request button, the client posts a 
WM_DDE_REQUEST message to the server. The server processes the 
message and posts a WM_DDE_DATA message back to the client with 
information. The client displays the result (the string you entered 
in the server's Item1 text box) on the Value line of the Request 
dialog box. Click Done to close the Request dialog box.

DDE Advise message
------------------

Use the DDE Advise message when you want to get information from the 
server whenever the item changes. Choose the DDE Advise command from 
the client window. The Advise dialog box displays a list of servers 
you are currently having conversations with. Enter "Item2" in the 
Item text box. This is the item you want to be advised on. When you 
click the Advise button, the client displays the result (the contents 
of the Item2 text box from the server) in its main window. Now type 
something into the Item2 text box in the server window and press the 
TAB key to go to the next item. When the focus changes, the server 
application posts a WM_DDE_DATA message with the new data and the 
client window is updated. Click Done to close the Advise dialog. 
The client window will continue to be updated with any changes in the 
value of Item2. 

DDE Unadvise message
--------------------

Use the DDE Unadvise message when you want to stop getting information 
from the server whenever the item changes. Choose the DDE Unadvise 
command from the client window. The Unadvise dialog box displays a 
list of servers you are currently having conversations with. Enter 
"Item2" in the Item text box. This is the item you do not want to be 
advised on anymore. When you click Unadvise, the server posts a 
WM_DDE_ACK message. Click Done to close the Unadvise dialog box. 
The client window no longer reflects any changes in the value of 
Item2.

DDE Poke message
----------------

Use the DDE Poke message when you want to send information to the 
server. Choose the DDE Poke command from the client window. The 
Poke dialog box displays a list of servers you are currently 
having conversations with. Enter "Item3" in the Item text box. 
This is the item you want to send information on. Now, type 
something into the Value text box. When you click the Poke 
button, the client posts a WM_DDE_POKE message to the server. 
The server displays the information in the Item3 text box and 
posts a WM_DDE_ACK message to notify the client that it was 
able to process the poked information. The WM_DDE_POKE message 
also contains information on who should destroy the data after it 
has been processed. Click Done to close the Poke dialog box.

DDE Execute message
-------------------

Use the DDE Execute message when you want to send commands to the 
server for execution. Choose the DDE Execute command from the 
client window. The Execute dialog box displays a list of servers 
you are currently having conversations with. Type one or more 
commands into the Execute String text box. Each command must 
be enclosed in brackets ([]). When you click the Execute button, 
the client application posts a WM_DDE_EXECUTE message to the 
server. The server performs the commands and posts a WM_DDE_ACK 
message to notify the client that it was able to process the 
specified commands. Click Done to close the Execute dialog box.

DDE Terminate message
---------------------

Use the DDE Terminate message when you want to stop all communications 
with the server. Choose the DDE Terminate command from the client 
window. The Terminate dialog box displays a list of servers you are 
currently having conversations with. Select the server you want to 
stop talking to and click OK. The client posts a WM_DDE_TERMINATE 
message and terminates the conversation when it receives a 
WM_DDE_TERMINATE message from the server or when a client-specified 
time-out period has lapsed.
