Posted to tcl by mjanssen at Thu Dec 14 10:55:39 GMT 2006view pretty

package require twapi
wm title . hWnd
wm attributes . -topmost 1
wm resizable . 0 0

bind all <ButtonPress> { . configure -cursor crosshair ; .td configure -cursor crosshair}
bind all <ButtonRelease> {set ::coords [window %X %Y] ; . configure -cursor {} ; .td configure -cursor {}}
entry .td -textvariable coords
pack .td -expand 1 -fill x

proc window {x y} {
	
    set xy [::twapi::get_mouse_location]
    set handle [::twapi::get_window_at_location [lindex $xy 0] [lindex $xy 1]]
    return $handle
}

bind . <F5> {console show}