Terminal version of GetWindowRect(GetConsoleWindow(), ...)? #10519

Closed
opened 2026-01-31 02:23:46 +00:00 by claunia · 10 comments
Owner

Originally created by @vefatica on GitHub (Sep 6, 2020).

My CUI app wants to know where the UI is. That was pretty straightforward in a console, GetWindowRect(GetConsoleWindow(), ...). Are there any suggestions for doing it when the host is Windows Terminal?

Originally created by @vefatica on GitHub (Sep 6, 2020). My CUI app wants to know where the UI is. That was pretty straightforward in a console, GetWindowRect(GetConsoleWindow(), ...). Are there any suggestions for doing it when the host is Windows Terminal?
claunia added the Needs-TriageNeeds-Tag-Fix labels 2026-01-31 02:23:46 +00:00
Author
Owner

@DHowett commented on GitHub (Sep 6, 2020):

No, this is not (and will not be) supported. The remoting infrastructure Terminal is built on also supports SSH and other windowless use cases (like pty hosting for tmux, screen, etc.).

It is also unsuitable for tabbed or paned presentation: what is the window rect of a console hosted in a tab that is not currently visible? Can it be said to have a window?

@DHowett commented on GitHub (Sep 6, 2020): No, this is not (and will not be) supported. The remoting infrastructure Terminal is built on also supports SSH and other windowless use cases (like pty hosting for tmux, screen, etc.). It is also unsuitable for tabbed or paned presentation: what is the window rect of a console hosted in a tab that is not currently visible? Can it be said to have a window?
Author
Owner

@DHowett commented on GitHub (Sep 6, 2020):

Any heuristic we could suggest would be subject to the same limitation 😄

@DHowett commented on GitHub (Sep 6, 2020): Any heuristic we could suggest would be subject to the same limitation :smile:
Author
Owner

@vefatica commented on GitHub (Sep 6, 2020):

Any heuristic we could suggest would be subject to the same limitation

Fine, suggest something.

@vefatica commented on GitHub (Sep 6, 2020): _Any heuristic we could suggest would be subject to the same limitation_ Fine, suggest something.
Author
Owner

@DHowett commented on GitHub (Sep 6, 2020):

Set the window title and then look it up by title. It’ll only tell you where the window containing the pane is, only when it’s active, and only on the same machine. If that’s fine-grained enough, that should work.

@DHowett commented on GitHub (Sep 6, 2020): Set the window title and then look it up by title. It’ll only tell you where the window containing the pane is, only when it’s active, and only on the same machine. If that’s fine-grained enough, that should work.
Author
Owner

@vefatica commented on GitHub (Sep 6, 2020):

Done that. It's fairly easy but has it's problems, as you noted.

If my app is the shell (i.e., was started by windowsterminal.exe) I can EnumWindows looking for the "CASCADIA_HOSTING_WINDOW_CLASS" window whose ProcessId matches that of my parent. That's more heavy-handed and also not perfect.

@vefatica commented on GitHub (Sep 6, 2020): Done that. It's fairly easy but has it's problems, as you noted. If my app is the shell (i.e., was started by windowsterminal.exe) I can EnumWindows looking for the "CASCADIA_HOSTING_WINDOW_CLASS" window whose ProcessId matches that of my parent. That's more heavy-handed and also not perfect.
Author
Owner

@vefatica commented on GitHub (Sep 6, 2020):

I'd like to see WindowsTerminal in action doing something other than hosting my local command interpreters. If I turn on my Win7-32bit machine, it will be networked. Is there some server software for Win7/32 and client software for Win10/64 that will let me mess around with (say) SSH?

@vefatica commented on GitHub (Sep 6, 2020): I'd like to see WindowsTerminal in action doing something other than hosting my local command interpreters. If I turn on my Win7-32bit machine, it will be networked. Is there some server software for Win7/32 and client software for Win10/64 that will let me mess around with (say) SSH?
Author
Owner

@DHowett commented on GitHub (Sep 6, 2020):

Yeah! Win32-OpenSSH ships a server that works down to Windows 7, and the client ships in-box on Windows 10.

@DHowett commented on GitHub (Sep 6, 2020): Yeah! [Win32-OpenSSH](https://github.com/powershell/win32-openssh) ships a server that works down to Windows 7, and the client ships in-box on Windows 10.
Author
Owner

@vefatica commented on GitHub (Sep 6, 2020):

Thanks. Yup. I was just fetching OpenSSH-Win32.zip and I found some install help. What's the client (Win10) and how do I do it all with WindowsTerminal?

@vefatica commented on GitHub (Sep 6, 2020): Thanks. Yup. I was just fetching OpenSSH-Win32.zip and I found some install help. What's the client (Win10) and how do I do it all with WindowsTerminal?
Author
Owner

@DHowett commented on GitHub (Sep 6, 2020):

The client that ships with Windows is ssh.exe, and it should already be on your PATH.

You can set up a profile whose commandline is something like ssh me@OtherMachine, and with public key authentication you won’t even need a password.

@DHowett commented on GitHub (Sep 6, 2020): The client that ships with Windows is `ssh.exe`, and it should already be on your `PATH`. You can set up a profile whose `commandline` is something like `ssh me@OtherMachine`, and with public key authentication you won’t even need a password.
Author
Owner

@vefatica commented on GitHub (Sep 6, 2020):

That was easy enough. So I've seen it work. This (below), however, failed on the Win7 machine. Any ideas?

G:\OpenSSH> .\ssh-keygen.exe -A
ssh-keygen: generating new host keys: RSA Could not save your public key in PROGRAMDATA\ssh/ssh_host_rsa_key.oWF6huZDVn: No such file or directory
ssh-keygen: generating new host keys: DSA Could not save your public key in PROGRAMDATA\ssh/ssh_host_dsa_key.i0FGCIuDpT: No such file or directory
ssh-keygen: generating new host keys: ECDSA Could not save your public key in PROGRAMDATA\ssh/ssh_host_ecdsa_key.F8esqlhL8V: No such file or directory
ssh-keygen: generating new host keys: ED25519 Could not save your public key in PROGRAMDATA\ssh/ssh_host_ed25519_key.7sgGF2SaAB: No such file or directory

That said, I do have these:

2020-09-06 16:35 6 sshd.pid
2020-09-06 16:25 2,297 sshd_config
2020-09-06 16:35 1,393 ssh_host_dsa_key
2020-09-06 16:35 613 ssh_host_dsa_key.pub
2020-09-06 16:35 513 ssh_host_ecdsa_key
2020-09-06 16:35 185 ssh_host_ecdsa_key.pub
2020-09-06 16:35 419 ssh_host_ed25519_key
2020-09-06 16:35 105 ssh_host_ed25519_key.pub
2020-09-06 16:35 2,610 ssh_host_rsa_key
2020-09-06 16:35 577 ssh_host_rsa_key.pub

That said, I am asked for a password. ... ?????

@vefatica commented on GitHub (Sep 6, 2020): That was easy enough. So I've seen it work. This (below), however, failed on the Win7 machine. Any ideas? G:\OpenSSH> .\ssh-keygen.exe -A ssh-keygen: generating new host keys: RSA Could not save your public key in __PROGRAMDATA__\\ssh/ssh_host_rsa_key.oWF6huZDVn: No such file or directory ssh-keygen: generating new host keys: DSA Could not save your public key in __PROGRAMDATA__\\ssh/ssh_host_dsa_key.i0FGCIuDpT: No such file or directory ssh-keygen: generating new host keys: ECDSA Could not save your public key in __PROGRAMDATA__\\ssh/ssh_host_ecdsa_key.F8esqlhL8V: No such file or directory ssh-keygen: generating new host keys: ED25519 Could not save your public key in __PROGRAMDATA__\\ssh/ssh_host_ed25519_key.7sgGF2SaAB: No such file or directory That said, I do have these: 2020-09-06 16:35 6 sshd.pid 2020-09-06 16:25 2,297 sshd_config 2020-09-06 16:35 1,393 ssh_host_dsa_key 2020-09-06 16:35 613 ssh_host_dsa_key.pub 2020-09-06 16:35 513 ssh_host_ecdsa_key 2020-09-06 16:35 185 ssh_host_ecdsa_key.pub 2020-09-06 16:35 419 ssh_host_ed25519_key 2020-09-06 16:35 105 ssh_host_ed25519_key.pub 2020-09-06 16:35 2,610 ssh_host_rsa_key 2020-09-06 16:35 577 ssh_host_rsa_key.pub That said, I am asked for a password. ... ?????
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#10519