FuPeiJiang / VD.ahk

Windows Virtual Desktop, AutoHotkey, Windows 11 support, Windows Server 2022, switch desktop, move window(wintitle) to current desktop; createDesktop, PinWindow, getCount, getDesktopNumOfWindow -> mute all windows in Virtual Desktop

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

New Windows Build 23606: VD.getCurrentDesktopNum() always returns 0

phazei opened this issue · comments

commented

Yesterday my windows just did an update and my script stopped working. I'm now on Insider Build 23606. I was previously on 23451 and it's been working just fine there.

commented

I took a look at the comments and it seems the GUID's changed for the later versions of Win11:

https://github.com/MScholtes/VirtualDesktop/blob/master/VirtualDesktop11-23H2.cs#L149-L190

I'm going to try switching those and see if it works or if it needs new win11 23h2 functions

commented

So, I'm really hoping the 23606 build I'm on matches the 23H2 build that has the new GUIDs. It took me a bit to understand, but I see now that the _vtable method is mapping the methods from the COMs. I updated the COM GUIDs to match the updated ones, but that didn't work by itself. I think the parameters for 23H2 so I changed the call back to:
DllCall(this.GetCurrentDesktop, "UPtr", this.IVirtualDesktopManagerInternal, "Ptr*", IVirtualDesktop_ofCurrentDesktop)

GetCurrentDesktop doesn't seem to return anything though, it seems to have been sharing the same _vtable 6 position so I didn't want to change that. But how exactly did you find out what # it was in the list? Is it possible to see the list of how the vtable looks like? I only have SciTE4AutoHotKey to debug this all and it only shows a long number for the values. Also, it seems GetCurrentDesktop returns an item of type IVirtualDesktop eg 3F07F4BE-B107-441A-AF0F-39D82529072C, so how does it get GetId() from it? I don't quite see where that comes from.

commented

So, it seems like the MScholtes/VirtualDesktop repo probably wouldn't work either. I'm not sure if this repo needed to be updated to match 23H2.

What I did find is a solution though. I found this https://github.com/itzjakm/VirtualDesktopAccessor (I'm guessing there's a typo and the submitter meant 23601). Seems to be a similar project but uses rust and compiles a DLL to be used with AHK. But they seem to have fixed it and found that there was an even more updated GUID. I updated that GUID and a couple others, then reverted the Win11 Insider build _vtable numbers back to stable Win11 numbers, and reverted a few Win11 method calls back to their Win10 equivalent, and it seems to be working now!

The version from ↑ PR works! Thanks! 🥇