Version 1 of Serving dde

Updated 2003-07-10 14:20:36

(July 10, 2003) Many applications expose services through DDE and let other applications interact with them. But if a Tcl application acts as a DDE server, with its own services, what does it have to offer?


PT 10-Jul-2003: By default, a Tcl dde server exposes all the commands and variables defined in the interpreter to remote dde requests. DDE requests require three identifiers - an application name, a topic and an item. For Tcl servers the application is always TclEval and the topic is whatever you provided as an argument to dde servername. The item name will be the name of a tcl command for execute or the name of a tcl variable for request. To illustrate - fire up a wish and execute 'package require dde ; dde servername alpha'. Now try

  % dde services TclEval {}
  alpha
  % dde execute TclEval alpha {puts Hello}   # Hello is printed in the remote window
  % dde request TclEval alpha tcl_patchLevel
  8.4.3

As you can see - we cause the server application to execute Tcl commands and to return variable values. Note that execute will not return a result to you. You'd need to use a temporary variable for this.