summaryrefslogtreecommitdiffstats
path: root/doc/dde.n
diff options
context:
space:
mode:
Diffstat (limited to 'doc/dde.n')
-rw-r--r--doc/dde.n151
1 files changed, 104 insertions, 47 deletions
diff --git a/doc/dde.n b/doc/dde.n
index 2ce319c..37d491b 100644
--- a/doc/dde.n
+++ b/doc/dde.n
@@ -1,24 +1,33 @@
'\"
'\" Copyright (c) 1997 Sun Microsystems, Inc.
+'\" Copyright (c) 2001 ActiveState Corporation.
'\"
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
-'\" RCS: @(#) $Id: dde.n,v 1.4 1999/08/21 19:40:48 hobbs Exp $
-'\"
+.TH dde n 1.4 dde "Tcl Bundled Packages"
.so man.macros
-.TH dde n 8.1 Tcl "Tcl Built-In Commands"
.BS
'\" Note: do not modify the .SH NAME line immediately below!
.SH NAME
dde \- Execute a Dynamic Data Exchange command
.SH SYNOPSIS
.sp
-\fBpackage require dde 1.1\fR
+\fBpackage require dde 1.4\fR
+.sp
+\fBdde servername\fR ?\fB\-force\fR? ?\fB\-handler \fIproc\fR? ?\fB\-\|\-\fR? ?\fItopic\fR?
+.sp
+.VS 8.6
+\fBdde execute\fR ?\fB\-async\fR? ?\fB\-binary\fR? \fIservice topic data\fR
.sp
-\fBdde \fIservername \fR?\fItopic\fR?
+\fBdde poke\fR ?\fB\-binary\fR? \fIservice topic item data\fR
+.VE 8.6
+.sp
+\fBdde request\fR ?\fB\-binary\fR? \fIservice topic item\fR
+.sp
+\fBdde services \fIservice topic\fR
.sp
-\fBdde ?\-async?\fR \fIcommand service topic \fR?\fIdata\fR?
+\fBdde eval\fR ?\fB\-async\fR? \fItopic cmd \fR?\fIarg arg ...\fR?
.BE
.SH DESCRIPTION
@@ -33,68 +42,104 @@ interpreter given by \fBdde servername\fR. Other applications have their
own \fIservice names\fR and \fItopics\fR. For instance, Microsoft Excel
has the service name \fBExcel\fR.
.PP
-The only option to the \fBdde\fR command is:
-.TP
-\fB\-async\fR
-Requests asynchronous invocation. This is valid only for the
-\fBexecute\fR subcommand. Normally, the \fBdde execute\fR subcommand
-waits until the command completes, returning appropriate error
-messages. When the \fB\-async\fR option is used, the command returns
-immediately, and no error information is available.
.SH "DDE COMMANDS"
.PP
The following commands are a subset of the full Dynamic Data Exchange
set of commands.
.TP
-\fBdde servername \fR?\fItopic\fR?
+\fBdde servername \fR?\fB\-force\fR? ?\fB\-handler \fIproc\fR? ?\fB\-\|\-\fR? ?\fItopic\fR?
+.
\fBdde servername\fR registers the interpreter as a DDE server with
the service name \fBTclEval\fR and the topic name specified by \fItopic\fR.
If no \fItopic\fR is given, \fBdde servername\fR returns the name
-of the current topic or the empty string if it is not registered as a service.
+of the current topic or the empty string if it is not registered as a
+service. If the given \fItopic\fR name is already in use, then a
+suffix of the form
+.QW " #2"
+or
+.QW " #3"
+is appended to the name to make it
+unique. The command's result will be the name actually used. The
+\fB\-force\fR option is used to force registration of precisely the
+given \fItopic\fR name.
+.RS
+.PP
+The \fB\-handler\fR option specifies a Tcl procedure that will be called to
+process calls to the dde server. If the package has been loaded into a
+safe interpreter then a \fB\-handler\fR procedure must be defined. The
+procedure is called with all the arguments provided by the remote
+call.
+.RE
.TP
-\fBdde execute \fIservice topic data\fR
-\fBdde execute\fR takes the \fIdata\fR and sends it to the server
-indicated by \fIservice\fR with the topic indicated by
-\fItopic\fR. Typically, \fIservice\fR is the name of an application,
-and \fItopic\fR is a file to work on. The \fIdata\fR field is given
-to the remote application. Typically, the application treats the
-\fIdata\fR field as a script, and the script is run in the
-application. The command returns an error if the script did not
-run. If the \fB\-async\fR flag was used, the command
-returns immediately with no error.
+\fBdde execute\fR ?\fB\-async\fR? ?\fB\-binary\fR? \fIservice topic data\fR
+.
+\fBdde execute\fR takes the \fIdata\fR and sends it to the server indicated
+by \fIservice\fR with the topic indicated by \fItopic\fR. Typically,
+\fIservice\fR is the name of an application, and \fItopic\fR is a file to
+work on. The \fIdata\fR field is given to the remote application.
+Typically, the application treats the \fIdata\fR field as a script, and the
+script is run in the application. The \fB\-async\fR option requests
+asynchronous invocation. The command returns an error message if the
+script did not run, unless the \fB\-async\fR flag was used, in which case
+the command returns immediately with no error.
+.VS 8.6
+Without the \fB\-binary\fR option all data will be sent in unicode. For
+dde clients which don't implement the CF_UNICODE clipboard format, this
+will automatically be translated to the system encoding. You can use
+the \fB\-binary\fR option in combination with the result of
+\fBencoding convertto\fR to send data in any other encoding.
+.VE 8.6
.TP
-\fBdde poke \fIservice topic data\fR
-\fBdde poke\fR takes the \fIdata\fR and sends it to the server
-indicated by \fIservice\fR with the topic indicated by
-\fItopic\fR. Typically, \fIservice\fR is the name of an application,
-and \fItopic\fR is a file to work on. The \fIdata\fR field is given
-to the remote application.
+\fBdde poke\fR ?\fB\-binary\fR? \fIservice topic item data\fR
+.
+\fBdde poke\fR passes the \fIdata\fR to the server indicated by
+\fIservice\fR using the \fItopic\fR and \fIitem\fR specified. Typically,
+\fIservice\fR is the name of an application. \fItopic\fR is application
+specific but can be a command to the server or the name of a file to work
+on. The \fIitem\fR is also application specific and is often not used, but
+it must always be non-null. The \fIdata\fR field is given to the remote
+application.
+.VS 8.6
+Without the \fB\-binary\fR option all data will be sent in unicode. For
+dde clients which don't implement the CF_UNICODE clipboard format, this
+will automatically be translated to the system encoding. You can use
+the \fB\-binary\fR option in combination with the result of
+\fBencoding convertto\fR to send data in any other encoding.
+.VE 8.6
.TP
-\fBdde request \fIservice topic item\fR
+\fBdde request\fR ?\fB\-binary\fR? \fIservice topic item\fR
+.
\fBdde request\fR is typically used to get the value of something; the
value of a cell in Microsoft Excel or the text of a selection in
Microsoft Word. \fIservice\fR is typically the name of an application,
\fItopic\fR is typically the name of the file, and \fIitem\fR is
application-specific. The command returns the value of \fIitem\fR as
-defined in the application.
+defined in the application. Normally this is interpreted to be a
+string with terminating null. If \fB\-binary\fR is specified, the
+result is returned as a byte array.
.TP
\fBdde services \fIservice topic\fR
+.
\fBdde services\fR returns a list of service-topic pairs that
currently exist on the machine. If \fIservice\fR and \fItopic\fR are
-both null strings ({}), then all service-topic pairs currently
-available on the system are returned. If \fIservice\fR is null and
+both empty strings ({}), then all service-topic pairs currently
+available on the system are returned. If \fIservice\fR is empty and
\fItopic\fR is not, then all services with the specified topic are
-returned. If \fIservice\fR is not null and \fItopic\fR is, all topics
-for a given service are returned. If both are not null, if that
-service-topic pair currently exists, it is returned; otherwise, null
-is returned.
+returned. If \fIservice\fR is non-empty and \fItopic\fR is, all topics
+for a given service are returned. If both are non-empty, if that
+service-topic pair currently exists, it is returned; otherwise, an
+empty string is returned.
.TP
-\fBdde eval \fItopic cmd \fR?\fIarg arg ...\fR?
-\fBdde eval\fR evaluates a command and its arguments using the
-interpreter specified by \fItopic\fR. The DDE service must be the
-\fBTclEval\fR service. This command can be used to replace send on
-Windows.
+\fBdde eval\fR ?\fB\-async\fR? \fItopic cmd \fR?\fIarg arg ...\fR?
+.
+\fBdde eval\fR evaluates a command and its arguments using the interpreter
+specified by \fItopic\fR. The DDE service must be the \fBTclEval\fR
+service. The \fB\-async\fR option requests asynchronous invocation. The
+command returns an error message if the script did not run, unless the
+\fB\-async\fR flag was used, in which case the command returns immediately
+with no error. This command can be used to replace send on Windows.
.SH "DDE AND TCL"
+.PP
A Tcl interpreter always has a service name of \fBTclEval\fR. Each
different interpreter of all running Tcl applications must be
given a unique
@@ -116,7 +161,7 @@ unpredictable results.
.PP
An external application which wishes to run a script in Tcl should have
that script store its result in a variable, run the \fBdde execute\fR
-command, and the run \fBdde request\fR to get the value of the
+command, and then run \fBdde request\fR to get the value of the
variable.
.PP
When using DDE, be careful to ensure that the event queue is flushed
@@ -126,7 +171,19 @@ without adding the \fB&\fR to place the process in the background).
If for any reason the event queue is not flushed, DDE commands may
hang until the event queue is flushed. This can create a deadlock
situation.
+.SH EXAMPLE
+.PP
+This asks Internet Explorer (which must already be running) to go to a
+particularly important website:
+.PP
+.CS
+package require dde
+\fBdde execute\fR -async iexplore WWW_OpenURL http://www.tcl.tk/
+.CE
.SH "SEE ALSO"
-tk, winfo, send
+tk(n), winfo(n), send(n)
.SH KEYWORDS
application, dde, name, remote execution
+'\"Local Variables:
+'\"mode: nroff
+'\"End: