Author |
Topic |
|
DerGolo
Germany
10 Posts |
|
Rob
USA
2615 Posts |
Posted - 03/18/2016 : 16:42:22
|
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! |
|
|
Rob
USA
2615 Posts |
Posted - 03/18/2016 : 20:37:52
|
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. |
|
|
DerGolo
Germany
10 Posts |
Posted - 03/23/2016 : 12:55:18
|
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 |
|
|
Rob
USA
2615 Posts |
Posted - 03/23/2016 : 13:38:43
|
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. |
|
|
DerGolo
Germany
10 Posts |
Posted - 03/23/2016 : 16:08:22
|
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. |
|
|
Rob
USA
2615 Posts |
Posted - 03/23/2016 : 17:16:53
|
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 :) |
|
|
DerGolo
Germany
10 Posts |
Posted - 03/23/2016 : 18:45:29
|
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 |
|
|
|
Topic |
|
|
|