• get_window_text of twapi can not get the text of another window's appli

    From luocl@21:1/5 to All on Fri Aug 12 10:21:40 2022
    get_window_text of twapi can not get the text of another window's
    application

    from twapi:
    get_window_text HWIN
    Gets the title of a window or the text associated with a control.
    In the latter case, the control must belong to the same application.

    but autohotkey(https://www.autohotkey.com) can get the text of another
    window's application

    I don't want drive autohotkey to do the work, I only want do this by Tcl.
    I study a lot, may be we can use the raw window's API of
    SendMessageTimeout of twapi to do this work. but I know a little C
    language, and know nothing about Window's SDK, anyone can help me?

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From luocl@21:1/5 to All on Fri Aug 12 10:50:41 2022
    On 8/12/22 10:21 AM, luocl wrote:

    the message type is GETTEXT and GETTEXTLENGTH

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Harald Oehlmann@21:1/5 to All on Fri Aug 12 08:25:54 2022
    Am 12.08.2022 um 04:21 schrieb luocl:
    get_window_text of twapi can not get the text of another window's
    application

    from twapi:
      get_window_text HWIN
        Gets the title of a window or the text associated with a control.
    In the latter case, the control must belong to the same application.

    but autohotkey(https://www.autohotkey.com) can get the text of another window's application

    I don't want drive autohotkey to do the work, I only want do this by Tcl.
    I study a lot, may be we can use the raw window's API of
    SendMessageTimeout of twapi to do this work. but I know a little C
    language, and know nothing about Window's SDK, anyone can help me?

    I can confirm, that this is possible, as long as it is the same user.
    You will not see windows from Administrator user, if you are a normal user.

    I recomment to put a ticket on TWAPI. This should be easy to change. I
    may contribute the code I use to Ashok.

    Take care,
    Harald

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From luocl@21:1/5 to Harald Oehlmann on Fri Aug 12 16:52:11 2022
    On 8/12/22 2:25 PM, Harald Oehlmann wrote:

    I can confirm, that this is possible, as long as it is the same user.
    You will not see windows from Administrator user, if you are a normal user.

    absolutely the same user in my use.
    I recomment to put a ticket on TWAPI. This should be easy to change. I
    may contribute the code I use to Ashok.

    a ticket is created: https://sourceforge.net/p/twapi/bugs/211/

    Thank you very much!!!

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From apn@21:1/5 to Harald Oehlmann on Fri Aug 12 16:14:07 2022
    On 8/12/2022 11:55 AM, Harald Oehlmann wrote:

    Am 12.08.2022 um 04:21 schrieb luocl:
    get_window_text of twapi can not get the text of another window's
    application

    from twapi:
       get_window_text HWIN
         Gets the title of a window or the text associated with a control. >> In the latter case, the control must belong to the same application.

    but autohotkey(https://www.autohotkey.com) can get the text of another
    window's application

    I don't want drive autohotkey to do the work, I only want do this by Tcl.
    I study a lot, may be we can use the raw window's API of
    SendMessageTimeout of twapi to do this work. but I know a little C
    language, and know nothing about Window's SDK, anyone can help me?

    I can confirm, that this is possible, as long as it is the same user.
    You will not see windows from Administrator user, if you are a normal user.

    I recomment to put a ticket on TWAPI. This should be easy to change. I
    may contribute the code I use to Ashok.

    Take care,
    Harald

    Harald,

    Please post the code you use here or on the wiki so other folks can use it.

    I am not likely to add it to TWAPI because while GetWindowText is
    documented, use of WM_GETTEXT is somewhat fraught with pitfalls. The
    correct handling can depend on the type of control, whether the window
    is Unicode or not, whether it is using default handlers etc. The
    returned value may be text, unicode, a window id, or even a handle.
    So while a specific use case example would be useful, I'm hesitant to
    add it as a general command to twapi and then have to support various
    edge cases that don't work right.

    AutoIt does it because they are far more cognizant of the vagaries of
    Windows messages and controls whereas twapi is not (and will never be).

    /Ashok

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Harald Oehlmann@21:1/5 to All on Fri Aug 12 13:51:07 2022
    Am 12.08.2022 um 12:44 schrieb apn:
    On 8/12/2022 11:55 AM, Harald Oehlmann wrote:

    Am 12.08.2022 um 04:21 schrieb luocl:
    get_window_text of twapi can not get the text of another window's
    application

    from twapi:
       get_window_text HWIN
         Gets the title of a window or the text associated with a
    control. In the latter case, the control must belong to the same
    application.

    but autohotkey(https://www.autohotkey.com) can get the text of
    another window's application

    I don't want drive autohotkey to do the work, I only want do this by
    Tcl.
    I study a lot, may be we can use the raw window's API of
    SendMessageTimeout of twapi to do this work. but I know a little C
    language, and know nothing about Window's SDK, anyone can help me?

    I can confirm, that this is possible, as long as it is the same user.
    You will not see windows from Administrator user, if you are a normal
    user.

    I recomment to put a ticket on TWAPI. This should be easy to change. I
    may contribute the code I use to Ashok.

    Take care,
    Harald

    Harald,

    Please post the code you use here or on the wiki so other folks can use it.

    I am not likely to add it to TWAPI because while GetWindowText is
    documented, use of WM_GETTEXT is somewhat fraught with pitfalls. The
    correct handling can depend on the type of control, whether the window
    is Unicode or not, whether it is using default handlers etc. The
    returned value may be text, unicode, a window id, or even a handle.
    So while a specific use case example would be useful, I'm hesitant to
    add it as a general command to twapi and then have to support various
    edge cases that don't work right.

    AutoIt does it because they are far more cognizant of the vagaries of
    Windows messages and controls whereas twapi is not (and will never be).

    /Ashok

    Ashok,

    thank you for asking. I have a bit the same problem. It is difficult and
    within a dll I authored. In practice, it is of little use, as many
    programs don't use standard widgets any more.

    Anyway, thank you for looking into it.
    You may close the bug as "not planned".

    Thanks for all,
    Harald

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Mole Cool@21:1/5 to All on Sat Aug 13 11:13:25 2022
    I use it to find and raise a login window, it is finding a lot of them, which is interesting:-)

    proc Wind_Sec_Find {cbr_HWIN} {
    upvar $cbr_HWIN HWIN
    set patternList [list "Windows Sec" "Enter Creden" "Sicurezza di Window" "Windows bizton" "Windows-Sicherheit"]

    set HWIN {}

    foreach pattern $patternList {
    set Winds [::twapi::find_windows -match glob -text $pattern*]
    if {[llength $Winds] } {
    set HWIN $Winds
    return 1
    }
    }
    return 0
    }

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)