diff --git a/VD.ah2 b/VD.ah2 index d90394e..757f157 100644 --- a/VD.ah2 +++ b/VD.ah2 @@ -9,8 +9,17 @@ class VD { if (this.hasOwnProp("_dll_GetCurrentDesktop")) { return } + ; Have to now get rev as well as build because the interfaces changed + ; between 22621.2134 and 22621.2283 (I'm presuming 2215 was the first rev + ; release with the change because of reports of this being a thing in + ; preview builds). Thanks, Microsoft! + ; + ; Tip for getting rev taken from lexikos at + ; https://www.autohotkey.com/boards/viewtopic.php?p=488604 splitByDot := StrSplit(A_OSVersion, ".") buildNumber := splitByDot[3] + splitByDot := StrSplit(FileGetVersion(A_WinDir . "\explorer.exe"), ".") + revNumber := splitByDot[4] if (buildNumber < 22000) { IID_IVirtualDesktopManagerInternal_ := "{F31574D6-B682-4CDC-BD56-1827860ABEC6}" IID_IVirtualDesktop_ := "{FF72FFDD-BE7E-43FC-9C03-AD81681E88E4}" @@ -19,7 +28,7 @@ class VD { this._dll_CreateDesktop := this._dll_CreateDesktop_Win10 this._dll_GetName := this._dll_GetName_Win10 this.RegisterDesktopNotifications := this.RegisterDesktopNotifications_Win10 - } else { + } else if (buildNumber <= 22621 and revNumber < 2215) { IID_IVirtualDesktopManagerInternal_ := "{B2F925B9-5A0F-4D2E-9F4D-2B1507593C10}" IID_IVirtualDesktop_ := "{536D3495-B208-4CC9-AE26-DE8111275BF8}" this._dll_GetCurrentDesktop := this._dll_GetCurrentDesktop_Win11 @@ -27,6 +36,22 @@ class VD { this._dll_CreateDesktop := this._dll_CreateDesktop_Win11 this._dll_GetName := this._dll_GetName_Win11 this.RegisterDesktopNotifications := this.RegisterDesktopNotifications_Win11 + } else if (buildNumber = 22621) { + IID_IVirtualDesktopManagerInternal_ := "{A3175F2D-239C-4BD2-8AA0-EEBA8B0B138E}" + IID_IVirtualDesktop_ := "{3F07F4BE-B107-441A-AF0F-39D82529072C}" + this._dll_GetCurrentDesktop := this._dll_GetCurrentDesktop_Win10 + this._dll_GetDesktops := this._dll_GetDesktops_Win10 + this._dll_CreateDesktop := this._dll_CreateDesktop_Win10 + this._dll_GetName := this._dll_GetName_Win11 + this.RegisterDesktopNotifications := this.RegisterDesktopNotifications_Win11 + } else { + IID_IVirtualDesktopManagerInternal_ := "{4970BA3D-FD4E-4647-BEA3-D89076EF4B9C}" + IID_IVirtualDesktop_ := "{3F07F4BE-B107-441A-AF0F-39D82529072C}" + this._dll_GetCurrentDesktop := this._dll_GetCurrentDesktop_Win10 + this._dll_GetDesktops := this._dll_GetDesktops_Win10 + this._dll_CreateDesktop := this._dll_CreateDesktop_Win10 + this._dll_GetName := this._dll_GetName_Win11 + this.RegisterDesktopNotifications := this.RegisterDesktopNotifications_Win11 } this.IVirtualDesktopManager := ComObject("{AA509086-5CA9-4C25-8F95-589D3C07B48A}", "{A5CD92FF-29BE-454C-8D04-D82879FB3F1B}") this.GetWindowDesktopId := this._vtable(this.IVirtualDesktopManager.Ptr, 4) @@ -41,7 +66,7 @@ class VD { this.Ptr_CreateDesktop := this._vtable(this.IVirtualDesktopManagerInternal.Ptr, 10) this.Ptr_RemoveDesktop := this._vtable(this.IVirtualDesktopManagerInternal.Ptr, 11) this.FindDesktop := this._vtable(this.IVirtualDesktopManagerInternal.Ptr, 12) - } else if (buildNumber < 22489) { + } else if (buildNumber < 22489 or (buildNumber = 22621 and revNumber > 2134) or buildNumber > 22621) { this.GetDesktops := this._vtable(this.IVirtualDesktopManagerInternal.Ptr, 7) this.Ptr_CreateDesktop := this._vtable(this.IVirtualDesktopManagerInternal.Ptr, 10) this.Ptr_RemoveDesktop := this._vtable(this.IVirtualDesktopManagerInternal.Ptr, 12)