-
Notifications
You must be signed in to change notification settings - Fork 45
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
3月26号修改的代码切换虚拟桌面失败 #36
Comments
note to self: Numpad5 doesn't follow if Desktop 2 has no windows activate "VD examples", click on it, then activate any other window (I used explorer.exe or chromium edge), then press Numpad2, nothing happens happens too in win11 |
…36 Gui VD_active_gui:Show ;you can only Show gui that's in another VD if a gui of same owned/process is already active Gui VD_animation_gui:Show ;after gui on current desktop owned by current process became active window, Show gui on different desktop owned by current process
现在修好了吗? |
刚试了下,在win10下还是不行。 我按的是 小键盘上的2,它还停留在原来的桌面。 |
cannot reproduce, can you try it on another computer? can you write an autohotkey script to do it? (that I can run on my computer) What's your does it work if you replace goToDesktopNum(desktopNum) { ; Lej77 https://github.com/Grabacr07/VirtualDesktop/pull/23#issuecomment-334918711
Gui VD_animation_gui:New, % "-Border -SysMenu +Owner -Caption +HwndVD_animation_gui_hwnd"
IVirtualDesktop := this._GetDesktops_Obj().GetAt(desktopNum)
GetId:=this._vtable(IVirtualDesktop, 4)
VarSetCapacity(GUID_Desktop, 16)
DllCall(GetId, "Ptr", IVirtualDesktop, "Ptr", &GUID_Desktop)
DllCall(this.MoveWindowToDesktop, "Ptr", this.IVirtualDesktopManager, "Ptr", VD_animation_gui_hwnd, "Ptr", &GUID_Desktop)
Gui VD_active_gui:New, % "-Border -SysMenu +Owner -Caption"
Gui VD_active_gui:Show ;you can only Show gui that's in another VD if a gui of same owned/process is already active
Gui VD_animation_gui:Show ;after gui on current desktop owned by current process became active window, Show gui on different desktop owned by current process
; Sleep 100
; Gui VD_animation_gui:Destroy
; Gui VD_active_gui:Destroy
; "ahk_class TPUtilWindow ahk_exe HxD.exe" instead of "ahk_class WorkerW ahk_exe explorer.exe"
; Sleep 50
; if (activeHwnd:=WinExist("A")) {
; if (!this._isValidWindow(activeHwnd)) {
; if (this._activateWindowUnder()==-1) {
; WinActivate % this.explorerDesktopWintitle
; }
; }
; } else {
; if (this._activateWindowUnder()==-1) {
; WinActivate % this.explorerDesktopWintitle
; }
; }
} ? (or simply commenting out |
也试一下这个 49766a2 (就更新一下) |
A_OSVersion 显示的是 10.0.19045
我试了这上,也不行。最后我把代码改成这样就可以了,注释了 Gui VD_animation_gui:Destroy 这一句就可以了
|
把 goToDesktopNum(desktopNum) { ; Lej77 https://github.com/Grabacr07/VirtualDesktop/pull/23#issuecomment-334918711
Gui VD_animation_gui:New, % "-Border -SysMenu +Owner -Caption +HwndVD_animation_gui_hwnd"
IVirtualDesktop := this._GetDesktops_Obj().GetAt(desktopNum)
GetId:=this._vtable(IVirtualDesktop, 4)
VarSetCapacity(GUID_Desktop, 16)
DllCall(GetId, "Ptr", IVirtualDesktop, "Ptr", &GUID_Desktop)
DllCall(this.MoveWindowToDesktop, "Ptr", this.IVirtualDesktopManager, "Ptr", VD_animation_gui_hwnd, "Ptr", &GUID_Desktop)
Gui VD_active_gui:New, % "-Border -SysMenu +Owner -Caption"
Gui VD_active_gui:Show ;you can only Show gui that's in another VD if a gui of same owned/process is already active
Gui VD_animation_gui:Show ;after gui on current desktop owned by current process became active window, Show gui on different desktop owned by current process
Sleep 500
Gui VD_animation_gui:Destroy
Gui VD_active_gui:Destroy
; "ahk_class TPUtilWindow ahk_exe HxD.exe" instead of "ahk_class WorkerW ahk_exe explorer.exe"
Sleep 50
if (activeHwnd:=WinExist("A")) {
if (!this._isValidWindow(activeHwnd)) {
if (this._activateWindowUnder()==-1) {
WinActivate % this.explorerDesktopWintitle
}
}
} else {
if (this._activateWindowUnder()==-1) {
WinActivate % this.explorerDesktopWintitle
}
}
} if goToDesktopNum(desktopNum) { ; Lej77 https://github.com/Grabacr07/VirtualDesktop/pull/23#issuecomment-334918711
Gui VD_animation_gui:New, % "-Border -SysMenu +Owner -Caption +HwndVD_animation_gui_hwnd"
IVirtualDesktop := this._GetDesktops_Obj().GetAt(desktopNum)
GetId:=this._vtable(IVirtualDesktop, 4)
VarSetCapacity(GUID_Desktop, 16)
DllCall(GetId, "Ptr", IVirtualDesktop, "Ptr", &GUID_Desktop)
DllCall(this.MoveWindowToDesktop, "Ptr", this.IVirtualDesktopManager, "Ptr", VD_animation_gui_hwnd, "Ptr", &GUID_Desktop)
Gui VD_active_gui:New, % "-Border -SysMenu +Owner -Caption"
Gui VD_active_gui:Show ;you can only Show gui that's in another VD if a gui of same owned/process is already active
Gui VD_animation_gui:Show ;after gui on current desktop owned by current process became active window, Show gui on different desktop owned by current process
Gui VD_active_gui:Destroy
loop 20 {
if (this.getCurrentDesktopNum()==desktopNum) { ; wildest hack ever..
Gui VD_animation_gui:Destroy
; "ahk_class TPUtilWindow ahk_exe HxD.exe" instead of "ahk_class WorkerW ahk_exe explorer.exe"
if (activeHwnd:=WinExist("A")) {
if (!this._isValidWindow(activeHwnd)) {
if (this._activateWindowUnder()==-1) {
WinActivate % "ahk_class Progman ahk_exe explorer.exe"
}
}
} else {
if (this._activateWindowUnder()==-1) {
WinActivate % "ahk_class Progman ahk_exe explorer.exe"
}
}
break
}
Sleep 25
}
} |
上边的两个代码试了,都不行。 |
…ToDesktopNum _activateWindowUnder; #36
wow, this is useful information, I will try to _activateWindowUnder(), then destroy it |
谢谢,此问题已解决。我用的autohotkey版本 v1版本是 v1.1.36.02 ; v2版本是 2.0.2 |
终于! |
to reproduce the bug, |
使用您最新3月26号修改的代码,在切换虚拟桌面的时候,有时没切成功。
我是在win10操作系统下,使用您提供的“VD examples”这个例子,按数字键盘“2”调用“VD.goToDesktopNum”切换虚拟桌面时,比如当前是在桌面1,要切到桌面2,桌面2里没有任何应用窗口即是一个空白桌面,此时切的时候切不过去,又回到了桌面1. 如果桌面2里已经有其它应用窗口,此时是可以成功切到桌面2的。
看了下代码大概是因为 调用 gui的Destroy销毁之后,系统又自动回到的原来的虚拟桌面。水平有限,不知咋修复,麻烦给看看
The text was updated successfully, but these errors were encountered: