windows-desktop-switcher
windows-desktop-switcher copied to clipboard
Current window not shifting to other virtual desktop
Hi @pmb6tz
This is such a useful script, thank you for building it! I've been working remotely now for a few weeks and this script has been a saviour when only having one screen.
I'm trying to get the MoveCurrentWindowToDesktop(desktopNumber) to work, but haven't had any success.
- The WinGet, activeHwnd, ID, A command works and pulls the right ID
- The switchDesktopByNumber(desktopNumber) works and sends me to the right desktop
The program stays on the original desktop. So the issue must be this line:
DllCall(MoveWindowToDesktopNumberProc, UInt, activeHwnd, UInt, desktopNumber - 1)
Which looks at:
global MoveWindowToDesktopNumberProc := DllCall("GetProcAddress", Ptr, hVirtualDesktopAccessor, AStr, "MoveWindowToDesktopNumber", "Ptr")
I haven't done any dll call stuff yet, so unsure where the issue may lay or if I missing something. Please let me know what I should look at to get this working. Thanks.
Regards,
submeg
Hi, @submeg, We're glad you liked the script!
Could you share the windows versiom that you're on (e.g. Version 1903)? The DLL sometimes gets outdated with a new version
By the way, AFAIR, there is a shortcut in windows to move window to the next desktop - if it happens rapidly and robustly enough we could maybe just remove the use of the dll
Hi @Elijas,
The Windows version I have is 1909.
Oh, if that's the case, I could update my script to trigger that shortcut? Does it know which desktop you want to move it to, or just the next available desktop (which I'm assuming wraps around)?
Good news, I checked, the DLL still works with the version 1909.
Could you try to install VS 2017 runtimes vc_redist.x64.exe (and/or) vc_redist.x86.exe ? Because the DLLs repository lists it as a dependency and says it was not provided by Windows out-of-the-box at the time.
@Elijas,
I installed both versions, but it will still just shift to the selected desktop, but will leave the active window on the previous desktop.
submeg
I have the Same Issue, I am on windows 1909
Test on another pc with windows 2004 Update, Desktop switching working well but Can't move Active windows to another desktop
hi all, any news on this one?
i have 20231, 1005 (windows pro insider preview) and same issue; how can i fix it?
I had this same issue, it was fixed by making sure that the line global hVirtualDesktopAccessor := DllCall("LoadLibrary", "Str", A_ScriptDir . "\VirtualDesktopAccessor.dll", "Ptr")
pointed accurately at VirtualDesktopAccessor.dll. Is the dll file in the same folder as the script calling the fuctions?
No luck here either. Windows 10 20H2
, build number 19042.746
Здесь тоже не повезло. Windows 10
20H2
, номер сборки19042.746
I have the exact same build and it works great on a lot of machines
pointed accurately at VirtualDesktopAccessor.dll
initially had this issue too, but as @MikeHotelOscar pointed out, the problem was making sure the script could find the DLL
on ver 20H2 build 19042.662
pointed accurately at VirtualDesktopAccessor.dll
initially had this issue too, but as @MikeHotelOscar pointed out, the problem was making sure the script could find the DLL
on ver 20H2 build 19042.662
And how does one fixes that? I tried putting full path to the desktop_switcher.ahk, but that doesn't help. Tried removing the first \
doesn't help either.
P.S. I'm using win11