TIP #150 Version 1.1: Implement the Tk send Command for Windows

This is not necessarily the current version of this TIP.


TIP:150
Title:Implement the Tk send Command for Windows
Version:$Revision: 1.1 $
Author:Pat Thoyts <patthoyts at users dot sourceforge dot net>
State:Draft
Type:Project
Tcl-Version:8.5
Vote:Pending
Created:Friday, 25 July 2003
Keywords:tk, send

Abstract

This TIP proposes to provide an implementation of the send mechanism for Tk under Windows.

Rationale

The Tk send command is used to provide an X server based mechanism for transmitting information between Tk applications. This provides the basis for remote introspection (tkinspect) and remote control (tkcon). This subsystem has never been implemented under Windows although there are means to emulate this using Tcl's dde package or the comm library. By providing a win32 implementation we help to standardise the Tk command set across platforms and will make it simpler to use this feature from Perl/Tk and Python Tkinter.

Reference Implementation

This implementation is based upon an integrated version of the winsend package currently at http://tclsoap.sf.net/winsend/. This uses the Windows Running Object Table to maintain interpreter registration information. This is a global system COM object that is provided as part of the Windows COM automation framework. Its purpose is to provide a single registry for maintaining references to active COM components.

When tk appname is called a COM component is created which contains a reference to the Tcl interpreter. This is then registered with the Running Object Table with the registration name containing the Tk app-name. To find available interpreters we use the winfo interps command. This iterates over all the registered objects looking for Tk registered names and can then return a list of registered interpreters.

The Tk send command is then provided as a COM method call. To perform a send, the client interpreter (or indeed any automation capable COM client) obtains the interpreter reference from the running object table and calls the Send method on this object, passing in the command as a string. For the synchronous version this is sufficient. The result is returned using the standard COM method calling and error information can be returned the same way.