📄 dde.n
字号:
'\"'\" 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.8 2002/06/27 22:29:08 dgp Exp $'\" .so man.macros.TH dde n 1.2 dde "Tcl Bundled Packages".BS'\" Note: do not modify the .SH NAME line immediately below!.SH NAMEdde \- Execute a Dynamic Data Exchange command.SH SYNOPSIS.sp\fBpackage require dde 1.2\fR.sp\fBdde \fIservername\fR ?\fItopic\fR?.sp\fBdde \fIexecute\fR ?\fI\-async\fR? \fIservice topic \fR?\fIdata\fR?.sp\fBdde \fIpoke\fR \fIservice topic item data\fR.sp\fBdde \fIrequest\fR ?\fI\-binary\fR? \fIservice topic \fR?\fIdata\fR?.sp\fBdde \fIservices\fR \fIservice topic \fR?\fIdata\fR?.sp\fBdde \fIeval\fR ?\fI\-async\fR? \fIservice topic \fR?\fIdata\fR?.BE.SH DESCRIPTION.PPThis command allows an application to send Dynamic Data Exchange (DDE)command when running under Microsoft Windows. Dynamic Data Exchange isa mechanism where applications can exchange raw data. Each DDEtransaction needs a \fIservice name\fR and a \fItopic\fR. Both the\fIservice name\fR and \fItopic\fR are application defined; Tcl usesthe service name \fBTclEval\fR, while the topic name is the name of theinterpreter given by \fBdde servername\fR. Other applications have theirown \fIservice names\fR and \fItopics\fR. For instance, Microsoft Excelhas the service name \fBExcel\fR..PPThe \fBeval\fR and \fBexecute\fR commands accept the option \fB\-async\fR:.TP.SH "DDE COMMANDS".PPThe following commands are a subset of the full Dynamic Data Exchangeset of commands..TP\fBdde servername \fR?\fItopic\fR?\fBdde servername\fR registers the interpreter as a DDE server withthe service name \fBTclEval\fR and the topic name specified by \fItopic\fR.If no \fItopic\fR is given, \fBdde servername\fR returns the nameof the current topic or the empty string if it is not registered as a service..TP\fBdde execute\fR ?\fI\-async\fR? \fIservice topic data\fR\fBdde execute\fR takes the \fIdata\fR and sends it to the server indicatedby \fIservice\fR with the topic indicated by \fItopic\fR. Typically,\fIservice\fR is the name of an application, and \fItopic\fR is a file towork on. The \fIdata\fR field is given to the remote application.Typically, the application treats the \fIdata\fR field as a script, and thescript is run in the application. The \fI\-async\fR option requestsasynchronous invocation. The command returns an error message if thescript did not run, unless the \fB\-async\fR flag was used, in which casethe command returns immediately with no error..TP\fBdde poke \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 applicationspecific but can be a command to the server or the name of a file to workon. The \fIitem\fR is also application specific and is often not used, butit must always be non-null. The \fIdata\fR field is given to the remoteapplication..TP\fBdde request\fR ?\fI\-binary\fR? \fIservice topic item\fR\fBdde request\fR is typically used to get the value of something; thevalue of a cell in Microsoft Excel or the text of a selection inMicrosoft Word. \fIservice\fR is typically the name of an application,\fItopic\fR is typically the name of the file, and \fIitem\fR isapplication-specific. The command returns the value of \fIitem\fR asdefined in the application. Normally this is interpreted to be astring with terminating null. If \fI\-binary\fR is specified, theresult is returned as a byte array..TP\fBdde services \fIservice topic\fR\fBdde services\fR returns a list of service-topic pairs thatcurrently exist on the machine. If \fIservice\fR and \fItopic\fR areboth null strings ({}), then all service-topic pairs currentlyavailable on the system are returned. If \fIservice\fR is null and\fItopic\fR is not, then all services with the specified topic arereturned. If \fIservice\fR is not null and \fItopic\fR is, all topicsfor a given service are returned. If both are not null, if thatservice-topic pair currently exists, it is returned; otherwise, nullis returned..TP\fBdde eval\fR ?\fI\-async\fR? \fItopic cmd \fR?\fIarg arg ...\fR?\fBdde eval\fR evaluates a command and its arguments using the interpreterspecified by \fItopic\fR. The DDE service must be the \fBTclEval\fRservice. The \fI\-async\fR option requests asynchronous invocation. Thecommand returns an error message if the script did not run, unless the\fB\-async\fR flag was used, in which case the command returns immediatelywith no error. This command can be used to replace send on Windows..SH "DDE AND TCL"A Tcl interpreter always has a service name of \fBTclEval\fR. Eachdifferent interpreter of all running Tcl applications must begiven a uniquename specified by \fBdde servername\fR. Each interp is available as aDDE topic only if the \fBdde servername\fR command was used to set thename of the topic for each interp. So a \fBdde services TclEval {}\fRcommand will return a list of service-topic pairs, where each of thecurrently running interps will be a topic..PPWhen Tcl processes a \fBdde execute\fR command, the data for theexecute is run as a script in the interp named by the topic of the\fBdde execute\fR command..PPWhen Tcl processes a \fBdde request\fR command, it returns the value of thevariable given in the dde command in the context of the interp named by thedde topic. Tcl reserves the variable \fB$TCLEVAL$EXECUTE$RESULT\fR forinternal use, and \fBdde request\fR commands for that variable will giveunpredictable results..PPAn external application which wishes to run a script in Tcl should havethat script store its result in a variable, run the \fBdde execute\fRcommand, and the run \fBdde request\fR to get the value of thevariable..PPWhen using DDE, be careful to ensure that the event queue is flushedusing either \fBupdate\fR or \fBvwait\fR. This happens by defaultwhen using \fBwish\fR unless a blocking command is called (such as \fBexec\fRwithout adding the \fB&\fR to place the process in the background).If for any reason the event queue is not flushed, DDE commands mayhang until the event queue is flushed. This can create a deadlocksituation..SH "SEE ALSO"tk(n), winfo(n), send(n).SH KEYWORDSapplication, dde, name, remote execution
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -