Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for latest Win11 interfaces #57

Closed
wants to merge 3 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 27 additions & 2 deletions VD.ah2
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
Expand All @@ -19,14 +28,30 @@ 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
this._dll_GetDesktops := this._dll_GetDesktops_Win11
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)
Expand All @@ -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)
Expand Down