Before trying to make two DDE programs communicate over a network, make them exchange data while both are running on the same computer to be sure you are successfully using DDE.
Once two programs are communicating on the same computer, it's easy to make them exchange data over a network by following the steps below:
Step 1. Assume Program Z is running on a host computer named ccc (your host computer's name can be set via the appropriate control panel), and Program Z is a DDE server program coded to respond to DDE requests that use service sss and topic ttt. Program Z itself will not have to be changed in any way to make it serve network DDE transactions.
Step 2A (for 16-bit Windows for Workgroups). In the [DDEShares] section of SYSTEM.INI on host ccc, create an entry like:
[DDEShares] xxx$=sss,ttt,,15,,0,,0,0,0You can edit SYSTEM.INI manually, or Microsoft's 16-bit DDESHARE.EXE utility can be used to edit SYSTEM.INI using a dialog interface. Choose something descriptive for xxx. You should also have LoadNetDDE=Yes in the [Network] section of your SYSTEM.INI file (that setting is toggled by the "Enable Network DDE" checkbox in the Startup Settings subdialog of the Network control panel accessory).
Step 2B (for 32-bit Windows, such as Windows 95 or Windows NT). Use REGEDIT.EXE on host ccc and modify hkey_local_machine/software/microsoft/netdde/dde shares to create a new entry identical to the CHAT$ entry, except use xxx$ instead of "CHAT$", use sss instead of "winchat" for the Application parameter, and use ttt instead of "chat" for the Topic parameter. On NT, you can use Microsoft's 32-bit DDESHARE.EXE utility to edit the registry using a dialog interface.
Step 3. A DDE client program can now remotely connect to DDE server Program Z by using service \\ccc\ndde$ and topic xxx$.
For example, if server Program Z responds to service ZP4 and topic Addresses, then a client program running on the same machine (a computer named Omphalos) can connect to Program Z using service ZP4 and topic Addresses. A remote client program running on a different machine can connect to Program Z using service \\Omphalos\ndde$ and topic Link$, if computer Omphalos contains the appropriate Registry or INI file entries created in Step 2 above that indicate Link$ should be translated into service ZP4 and topic Addresses.
To summarize: local unnetworked DDE clients establish a connection by naming the actual desired service and topic. Remote networked DDE clients establish a connection by naming the desired computer and configuration file entry, and the operating system does the work of finding the desired service and topic in the configuration file on the desired computer.
Problems making everything work? Microsoft's Hearts game uses network DDE to communicate between players. If you can get Hearts working between two machines, you are using network DDE. You can also run WINCHAT.EXE, which should display an error message if network DDE is not available.
In 16-bit Windows for Workgroups, NETDDEX.EXE is in the load= line of WIN.INI [Windows] and confirms NetBIOS has been loaded and that SYSTEM.INI [Network] ComputerName= has a valid entry. NETDDE.EXE and NDDENB.DLL must also be present on your system.
Under Windows 95, NETDDE.EXE is not automatically started. Create a shortcut to NETDDE.EXE and place it in the Startup folder to make Windows 95 start NETDDE.EXE every time the system boots.
Under Windows NT, network DDE is very problematic, as discussed in the online documentation at microsoft.com (such as articles Q114089, Q186482, Q105195, Q169896, Q114089, and Q148129). Because of the difficulty of administering network DDE on the NT version of Windows, NT users may find it more convenient to run the application acting as the DDE server on a non-NT machine connected to their NT network.
PROGRAMMERS: To code DDE client/server applications, use the routines in the Dynamic Data Exchange Management Library (DDEML), as opposed to the harder-to-implement lower-level basic DDE routines the DDEML is built on. In other words, most of your code will be like Chapter 77 in Volume 2 of the Win32 Programmer's Reference as opposed to Chapter 26 in Volume 1. For Windows 3.1, low-level DDE is described in Chapter 22 of the Windows 3.1 Guide to Programming and DDEML is described in Programmer's Reference Volume 1. Microsoft also has sample DDEML programs posted online.