Microsoft's Component Object Model , or COM, a component of Windows, enables software components to communicate.
Many popular Windows applications expose a COM automation interface , which allows external programs to launch and control them.
Alex Martelli: "COM-related technologies seem mostly pretty good, except for the little detail that they're often huge, rambling, and full of redundancies and pitfalls -- this goes for the object model of WMI just as well as for those of MS Office applications."
At various times, steveo, stever, CL, and others have worked on DCOM.
[Explain relation between COM and WSH.]
The starting point to an application's COM automation interface is through its programmatic identifier (ProgID).
Here are a few example ProgID's, any of which might be used in, for instance, tcom with
set application [::tcom::ref createobject $ProgID] Netscape.Network.1 [http://developer.netscape.com/docs/manuals/communicator/OLE/ole2net.htm] FrontPage.Editor.Document Word.Document (note that WordPad is ''not'' a COM server) InternetExplorer.Application Excel.Application Excel.Application.8 PDF.PdfCtrl.1 Word.Application DSOleFile.PropertyReader
In How do you find all ActiveX servers? , comp.lang.tcl, 2001-10-19, Chin Huang provides the following code to search the Windows registry for available COM objects, and prints their ProgID:
package require registry set classesRootKey "HKEY_CLASSES_ROOT\\CLSID" foreach clsid [registry keys $classesRootKey] { set clsidKey "$classesRootKey\\$clsid" set progIdSubKey [registry keys $clsidKey "VersionIndependentProgID"] if {[llength $progIdSubKey] > 0} { set progId [registry get "$clsidKey\\$progIdSubKey" ""] puts $progId } }
One of the eternal puzzles of COM work is how to find the right constants. Mark Hammond packaged up his insight on COM's constants into a Python module called win32com.clients.constants . Presumably we could, given enough motivation, do the same for Tcl, or at least render the code into human-readable direction.
The section titled How to Obtain Built-In Constant Values for an Office Application on the page How one discovers the API for a COM-exporting application explains how to do this using tcom.
COM Structured Storage provides file and data persistence in COM by handling a single file as a structured collection of objects known as storages and streams. Pat Thoyts' tclstorage provides access to Structured Storage from Tcl.
Pat also has an "OLE Application automation" [L1 ]
PYK 2019-08-12: Microsoft has made the C++ source code for a Compound File Binary Format reader freely available here .