• Windows: detect if user changed

    From Harald Oehlmann@21:1/5 to All on Tue Nov 30 10:25:31 2021
    Is there any possibility to find out, if a user pressed on "change user"
    and thus, the tcl shell is "suspended" ?


    I tried all "wm protocol" variants, but nothing fired.

    When a user loggs out, the command of "wm protocol WM_SAVE_YOURSELF" is
    called.

    Thanks for any idea,
    Harald

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Harald Oehlmann@21:1/5 to All on Wed Dec 1 15:09:56 2021
    Am 30.11.2021 um 10:25 schrieb Harald Oehlmann:


    Is there any possibility to find out, if a user pressed on "change user"
    and thus, the tcl shell is "suspended" ?


    I tried all "wm protocol" variants, but nothing fired.

    When a user loggs out, the command of "wm protocol WM_SAVE_YOURSELF" is called.

    Thanks for any idea,
    Harald

    I have made some research.

    The similar "wm protocol WM_SAVE_YOURSELF" is implemented in
    win/tkWinWm.c and reacts on the Windows message "WM_QUERYENDSESSION".

    A user change (Press Windows button, and then "change user") is
    apparently reported by the windows message "WM_WTSSESSION_CHANGE"

    But one must first activate this per Window calling WTSRegisterSessionNotification.:

    Are there any opinion on:

    - is it senseful to add this to the core? As this will be Tk 8.7, means
    that the feature is available in 5 years or later ;-)
    - may this be included in Tk 8.6 ? I am not sure, if the required
    Windows API is supported by the minimum requirement for 8.6.
    - is there a way to use twapi for this? Maybe, twapi has a framework to
    receive windows messages.
    - or is it a good idea to create a custom DLL which creates a dummy
    window just for this ? It is a large overhead, but probably the only
    workable solution.

    Any idea appreciated.

    Thank you,
    Harald

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Harald Oehlmann@21:1/5 to All on Fri Dec 3 16:10:01 2021
    Am 01.12.2021 um 15:09 schrieb Harald Oehlmann:
    Am 30.11.2021 um 10:25 schrieb Harald Oehlmann:


    Is there any possibility to find out, if a user pressed on "change
    user" and thus, the tcl shell is "suspended" ?


    I tried all "wm protocol" variants, but nothing fired.

    When a user loggs out, the command of "wm protocol WM_SAVE_YOURSELF" is
    called.

    Thanks for any idea,
    Harald

    I have made some research.

    The similar "wm protocol WM_SAVE_YOURSELF" is implemented in
    win/tkWinWm.c and reacts on the Windows message "WM_QUERYENDSESSION".

    A user change (Press Windows button, and then "change user") is
    apparently reported by the windows message "WM_WTSSESSION_CHANGE"

    But one must first activate this per Window calling WTSRegisterSessionNotification.:

    Are there any opinion on:

    - is it senseful to add this to the core? As this will be Tk 8.7, means
    that the feature is available in 5 years or later ;-)
    - may this be included in Tk 8.6 ? I am not sure, if the required
    Windows API is supported by the minimum requirement for 8.6.
    - is there a way to use twapi for this? Maybe, twapi has a framework to receive windows messages.
    - or is it a good idea to create a custom DLL which creates a dummy
    window just for this ? It is a large overhead, but probably the only
    workable solution.

    Any idea appreciated.

    Thank you,
    Harald


    Ashok has presented by private mail a solution which implements the
    upper in TWAPI and works great.
    Thank you for that.

    Nevertheless, I see still value to add this to core Tk.

    Thank you all,
    Harald

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