Closed MichaRotstein closed 1 year ago
You can save the active window by desktop, and when switching desktop and activate the window. It should be doable with AHK.
Thanks @Ciantic ! Sorry for late reply
My issue is the dll only provides RegisterPostMessageHookProc at which point I can no longer ask AHK for the currently activated window to save it !
Is there a way to get a hook before the VD changes ? Or any other idea ?
I did manage to solve this:
VDA_PATH := A_ScriptDir . "\VirtualDesktopAccessor.dll"
hVirtualDesktopAccessor := DllCall("LoadLibrary", "Str", VDA_PATH, "Ptr")
GetCurrentDesktopNumberProc := DllCall("GetProcAddress", "Ptr", hVirtualDesktopAccessor, "AStr", "GetCurrentDesktopNumber", "Ptr")
GoToDesktopNumberProc := DllCall("GetProcAddress", "Ptr", hVirtualDesktopAccessor, "AStr", "GoToDesktopNumber", "Ptr")
hWnd := Map()
capslock:: {
current := DllCall(GetCurrentDesktopNumberProc, "Int")
hWnd[current] := WinActive('A')
next:= current = 0 ? 1 : 0
DllCall(GoToDesktopNumberProc, "Int", next, "Int")
Try WinActivate hWnd[next]
}
Here is the scenario:
This issue makes virtual desktops very annoying in heavy use, seems to be a windows bug, is there a way around it using this dll and AHK ?