Hello Ashok,
I'm not quite sure what you mean by needing an HWIN. Some commands might
have "hwin" as an argument name. But that's just an argument name. It
might as well be "foo".
well, from 'twapi::get_foreground_window' I got '41224048 HWND' and I
read in twapi's documentation 'set_foreground_window HWIN' - so I
assumed that those are 2 different types. All the better if they are
not.
I am trying to give a certain window the focus but failed miserably.
I have this little test script t.tcl:
---
package require Tk
package require twapi
wm title "." "Test" --------- this is used below
set t [text .t -width 40 -height 10]
pack $t
$t insert end "aaa\nbbb\nccc\n"
focus $t
---
and in TkCon I do this:
---
loading history file ... 42 events added
buffer line limit: 512 max line length: unlimited
Main console display active (Tcl8.6.10 / Tk8.6.10)
(GUI) 43 % source t.tcl
(GUI) 44 % set hwnd [twapi::find_windows -match glob -text Test]
{11535582 HWND} ----- this identifies my test window
(GUI) 45 % twapi::set_focus $hwnd
Invalid pointer or opaque value '{11535582 HWND}'.
(GUI) 46 % twapi::set_focus $hwnd [lindex $hwnd 0]
wrong # args: should be "twapi::set_focus hwin"
(GUI) 47 % twapi::set_foreground_window $hwnd
Invalid pointer or opaque value '{11535582 HWND}'.
(GUI) 48 % twapi::set_foreground_window $hwnd [lindex $hwnd 0]
wrong # args: should be "twapi::set_foreground_window hwin"
(GUI) 49 %
---
So evidently I am doing something wrong or did not yet understand it -
but how am I supposed to use the result of 'find_windows' and similar functions?
Any help or advice will be greatly appreciated.
Helmut
--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)