This App is No Longer Maintained. Visit the Replacement at StrokesPlus.net

StrokesPlus Forum
                       
StrokesPlus Forum
Home | Profile | Active Topics
Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Feature Updates
 Requests
 Action to move window to another Desktop
 Forum Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

DerGolo

Germany
10 Posts

Posted - 03/17/2016 :  03:09:37  Show Profile
As discussed here: http://www.strokesplus.com/forum/topic/1084/virtual-desktop-win-10, a possibility to move a window to another virtual desktop via a lua function.

Rob

USA
2615 Posts

Posted - 03/18/2016 :  16:42:22  Show Profile  Visit Rob's Homepage
Looking at the MSDN documentation here, https://msdn.microsoft.com/en-us/library/windows/desktop/mt186440.aspx, it looks like there aren't many actual methods.

Now, getting the current desktop, moving an app, and getting a desktop ID is supported. However, you cannot enumerate the available virtual desktops. It looks like this is very intentional from a user experience perspective; Microsoft doesn't want apps messing with the user's desktops/app locations, just like changing the default audio device cannot be done programmatically anymore.

So, I'll add those in S+ because there's no harm in doing so, but it looks like the only way you'd be able to move an app to a different desktop will be that you'll have to get the virtual desktop destination only by knowing the handle to a window currently in the target desktop. That can still be useful, but is not as directly intuitive as you might prefer.

Some options would be:

- If you always have a window in each desktop, it would be easy to get the desktop by calling the GetWindowDesktopId function specifying the window you know will always be in the destination.
- You could tag the desktops when you start up Windows. Meaning, you switch to desktop 1, draw a gesture/use a hotkey which calls the GetWindowDesktopId function for the foreground window and store it into a variable using the newly added functions in 2.8.6.3, e.g. acSetStringVariable("Desktop1", acGetWindowDesktopId(acGetForegroundWindow())). Then switch to the other desktop and tag it, but store it in a different variable. Then you could reference those variables in other scripts when you want to move apps between desktops.

It's not ideal, but with without being able to enumerate desktops (especially if they don't have consistent names/device IDs), it's about the only way to go about it. However, it should work!
Go to Top of Page

Rob

USA
2615 Posts

Posted - 03/18/2016 :  20:37:52  Show Profile  Visit Rob's Homepage
Well crap! I just spent the last 3 hours coding this all up, with a lot of various frustrations...only to find out that those calls ONLY WORK FOR WINDOWS THAT YOUR PROCESS OWNS! So they work fine for the S+ window, but cannot be used on any other windows.

Oh well, it was a really great idea!

I'll leave this open anyway, in case I come across something or Microsoft changes their minds. I am aware that there are undocumented and unsupported desktop functions that have been around in the WinAPI for years now, but I intentionally will not build that stuff into S+ for stability, consistency, etc. Not that I know whether they would even work with Windows 10, but just to mention it.
Go to Top of Page

DerGolo

Germany
10 Posts

Posted - 03/23/2016 :  12:55:18  Show Profile
Dear Rob,

thank you very much for your intend to solve. I am using the software "SylphyHorn" right now as mentioned in the initial old post. The software handles any window and is not restricted to the own process. There is the source code available, too: https://github.com/Grabacr07/SylphyHorn

If you want to try it, here is a download of the full working version: https://owncloud.dergolo.de/index.php/s/I2UO2d5jif3UdtR

Maybe this is interesting for you.

Bye,
Golo
Go to Top of Page

Rob

USA
2615 Posts

Posted - 03/23/2016 :  13:38:43  Show Profile  Visit Rob's Homepage
Ah, it's installing a system-wide hook to intercept all window messages for all apps, then attaches to the thread so it's executing within the context of the process. I tend to prefer to avoid hooking so many events across the system, but will keep it in mind.
Go to Top of Page

DerGolo

Germany
10 Posts

Posted - 03/23/2016 :  16:08:22  Show Profile
Maybe it is a good choice to make the system wide hook only a configurable option where - when chosen - the user can be cleared up the impact.
Go to Top of Page

Rob

USA
2615 Posts

Posted - 03/23/2016 :  17:16:53  Show Profile  Visit Rob's Homepage
Right, I would definitely do that as well, but there are other implications in terms of the fact that S+ supports all the way back to Win XP SP3 (before the Desktop manager existed), so there has to be some architectural considerations, etc. Certainly nothing that can't be overcome, but it does make things a bit more complicated. I will definitely include the functionality in the new StrokesPlus I'm building from scratch, though :)
Go to Top of Page

DerGolo

Germany
10 Posts

Posted - 03/23/2016 :  18:45:29  Show Profile
Sounds great and thanks again for your work, please accept a litte donation from my site (sent via paypal).

Edited by - DerGolo on 03/23/2016 18:48:06
Go to Top of Page
  Previous Topic Topic Next Topic  
 Forum Locked
 Printer Friendly
Jump To:
StrokesPlus Forum © 2011-2018 Rob Yapchanyk Go To Top Of Page
Snitz Forums 2000