MScholtes / PSVirtualDesktop

VirtualDesktop is a Powershell module that provides commandlets to manage virtual desktops of Windows 10.
MIT License
304 stars 18 forks source link

Issue when moving windows with multiple processes/tabs #1

Closed lihuelworks closed 5 years ago

lihuelworks commented 5 years ago

I'm having a difficulty moving a window with multiple processes, like Chrome and Explorer, to another virtual desktop using the samples in the Github Readme.

Expected behavior: The sample command is input a Powershell session, and the window (e.g Chrome) is moved to the desired desktop (The third one, number 2).

Actual Behavior: The command gives an error in parameters akin to this (The second command is to prove Chrome exists, being a window with two tabs)

Screenshot_39

Edit: I think it has to do with how MainWindowHandle gets the Handle number, as this StackOverflow post puts it (https://stackoverflow.com/questions/4727023/why-cant-get-the-main-window-handle-for-a-started-process). It may also happen with fullscreen apps.

MScholtes commented 5 years ago

Hello lihuelworks,

This is not really an issue with PSVirtualDesktop but with the way Windows retrieves window handles. But I will investigate this, maybe there is a comfortable solution.

Greetings

Markus

MScholtes commented 5 years ago

Hello lihuelworks,

in the new version 1.1.0 of VirtualDesktop there is the function Find-WindowHandle. You use it to find a window with the text (partly is allowed, search is case insensitive) in its title. If that is not enough, you can get a list of windows with handles with Find-WindowHandle '*'

I hope this solves your issue.

Greetings

Markus

MScholtes commented 5 years ago

Since there was no reply for over a month I assume the issue is closed with the latest Version of PSVirtualDesktop.