[Richard Suchenwirth] 2002-09-18 : I've learned and preached that Tcl/Tk can be used to glue software components together, but how strong this is I experienced only last night. [Steve Offutt] hinted me in the [Tcl chatroom] at [optcl], an extension that allows exploring and using [Windows] [COM] modules, and mailed me a little 2 KB script that implements a web [Browser] (by embedding part of Internet Explorer via optcl), animated [GIF]s as well as directory browsing supported, and even Acrobat Reader gets embedded in turn if you point it to a [PDF] document. [WikiDbImage comon.jpg] I played with it at home, adjusted and simplified it somehow, and noticed that the whole browser, capable of navigating the WWW as well as your local file system, can fit in less than 1 KB (if you exempt these explanations, and assuming you're on Windows >= 95 and accept the [GPL]), while allowing you to style it at your heart's delight, just as we know it from [Tcl]. (Only [printing] is not supported, '''it is now''' ~ [MPJ], but we know that from Tcl too ;-) So here goes my "lean and mean" version: } ====== wm title . {COM on!} package require optcl # local setting on my box at home set home c:/html/index.htm option add *Button.pady 0 option add *Button.borderWidth 1 option add *Button.relief flat bind Button {+ %W config -relief raised} bind Button {+ %W config -relief flat} set htm [optcl::new -window .htm Shell.Explorer.2] .htm config -width 600 -height 400 frame .fr button .fr.h -text ^ -command {catch {$htm navigate [set url $home]}} button .fr.o -text ... -command {$htm navigate [set url [tk_getOpenFile]]} button .fr.b -text < -command {catch {$htm goBack}} button .fr.f -text > -command {catch {$htm goForward}} button .fr.p -text P -command { catch {$htm ExecWB OLECMDID_PRINT OLECMDEXECOPT_PROMPTUSER}} entry .fr.e -textvar url -width 80 bind .fr.e {$htm navigate $url} set url $home pack {*}[winfo children .fr] -side left -fill y pack .fr -fill x pack .htm -fill both -expand 1 catch {$htm navigate $url} bind . {exec wish $argv0 &; exit} ;# useful in development ====== ---- [SO] 2009-09-19 : I appreciate Richard mentioning our conversation in the chatroom, and the little script I mailed him. I would be remiss, however, if I failed to point out that my little hack was based on a script provided by [Michael Jacobson], on the [optcl] page. Also, I would love to see other examples of using optcl/[tcom] appear on the [wiki]. These are truly powerful tools for those of us who spend most of our programming time in the world of windows. ---- [MPJ] 2002-09-19 : Note there is a little bug in Tk or optcl that does not allow the text box to `[grab]` the `[focus]` correctly . See [https://groups.google.com/d/msg/comp.lang.tcl/-XcMUmwo2Sg/kBYOuWLwusUJ%|%solution for regaining focus from OpTcl hosted ActiveX control] , [comp.lang.tcl] , 2002-03-01 . I notice that your little app has this problem too. I mention it on the optcl page with this solution (using my other favorite dll ... [ffidl]). '''UPDATE''' I like the way [GPS] solved this on his [WippleWobble - A Mini Web Browser (for Windows)] page using forceFocus proc. ====== load ffidl05.dll ffidl::callout dll_SetFocus {int} int [ffidl::symbol user32.dll SetFocus] proc GrabFocus {args} {dll_SetFocus [winfo id .]} bind .