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
MIT License
319 stars 45 forks source link

getDesktopNumOfWindow sometimes returns -1 rather than the correct num #46

Open zhcqiu opened 1 year ago

zhcqiu commented 1 year ago

If I minimize a window in other virtual desktops, the VD.getDesktopNumOfWindow sometimes returns -1 rather than the correct num. Some apps don't have such a problem, such as notepad.exe, while others, like telegram.exe, code.exe, and tim.exe, have such a problem. According to my analysis, the problem may be due to the method: _tryGetValidWindow. I use Windows 11 Pro, the English version, and AutoHotkey 2.02. I wonder if others encounter such a problem.

FuPeiJiang commented 1 year ago

I was able to reproduce using telegram.exe portable, a winTitle of "Telegram" has many possible hwnd, I need to loop through them

zhcqiu commented 1 year ago

I guess a loop through the virtual desktops to read ahk_id may be a good idea.

FuPeiJiang commented 1 year ago

@zhcqiu

FuPeiJiang added a commit that referenced this issue 13 hours ago

update and try, does it work now ?

zhcqiu commented 1 year ago

I updated the script, and it works. Thank you very much!