Ciantic / VirtualDesktopAccessor

DLL for accessing Windows 11/10 Virtual Desktop features from e.g. AutoHotkey
MIT License
772 stars 93 forks source link

23H2 22631.3155 appears to break functionality #91

Closed levouh closed 8 months ago

levouh commented 8 months ago

I see the updates made here which fixed the last version, but I am not familiar with anything in that PR.

Would someone be willing to help me understand what is needed to debug/make this work as Windows makes updates? Obviously this is a very specific process depending on what breaks, but gotta start somewhere. TIA.

jmbeach commented 8 months ago

Yeah, randomly broken for me too.

Ciantic commented 8 months ago

Interesting, I have 23H2 22631.3155 yet it still works without changes.

What functionality break?

levouh commented 8 months ago

Here is a sample (AHK V2 script) of some things that I use that no longer work @Ciantic:

#Requires AutoHotkey v2.0

#SingleInstance Force

; VDA

VDA_PATH := A_ScriptDir . "\VirtualDesktopAccessor.dll"
hVirtualDesktopAccessor := DllCall("LoadLibrary", "Str", VDA_PATH, "Ptr")
GetDesktopCountProc := DllCall("GetProcAddress", "Ptr", hVirtualDesktopAccessor, "AStr", "GetDesktopCount", "Ptr")
GoToDesktopNumberProc := DllCall("GetProcAddress", "Ptr", hVirtualDesktopAccessor, "AStr", "GoToDesktopNumber", "Ptr")
GetCurrentDesktopNumberProc := DllCall("GetProcAddress", "Ptr", hVirtualDesktopAccessor, "AStr", "GetCurrentDesktopNumber", "Ptr")
IsWindowOnCurrentVirtualDesktopProc := DllCall("GetProcAddress", "Ptr", hVirtualDesktopAccessor, "AStr", "IsWindowOnCurrentVirtualDesktop", "Ptr")
IsWindowOnDesktopNumberProc := DllCall("GetProcAddress", "Ptr", hVirtualDesktopAccessor, "AStr", "IsWindowOnDesktopNumber", "Ptr")
MoveWindowToDesktopNumberProc := DllCall("GetProcAddress", "Ptr", hVirtualDesktopAccessor, "AStr", "MoveWindowToDesktopNumber", "Ptr")
PinWindowProc := DllCall("GetProcAddress", "Ptr", hVirtualDesktopAccessor, "AStr", "PinWindow", "Ptr")
UnPinWindowProc := DllCall("GetProcAddress", "Ptr", hVirtualDesktopAccessor, "AStr", "UnPinWindow", "Ptr")
IsPinnedWindowProc := DllCall("GetProcAddress", "Ptr", hVirtualDesktopAccessor, "AStr", "IsPinnedWindow", "Ptr")
GetDesktopNameProc := DllCall("GetProcAddress", "Ptr", hVirtualDesktopAccessor, "AStr", "GetDesktopName", "Ptr")
SetDesktopNameProc := DllCall("GetProcAddress", "Ptr", hVirtualDesktopAccessor, "AStr", "SetDesktopName", "Ptr")
CreateDesktopProc := DllCall("GetProcAddress", "Ptr", hVirtualDesktopAccessor, "AStr", "CreateDesktop", "Ptr")
RemoveDesktopProc := DllCall("GetProcAddress", "Ptr", hVirtualDesktopAccessor, "AStr", "RemoveDesktop", "Ptr")

desktop_count := 3

get_current_desktop_number() {
    global GetCurrentDesktopNumberProc

    return DllCall(GetCurrentDesktopNumberProc)
}

is_window_on_desktop(win_id, num) {
    global IsWindowOnDesktopNumberProc 

    return DllCall(IsWindowOnDesktopNumberProc, "Int", win_id, "Int", num, "Int")
}

get_current_desktop() {
    global GetCurrentDesktopNumberProc 

    return DllCall(GetCurrentDesktopNumberProc, "Int")
}

goto_desktop(num) {
    global GoToDesktopNumberProc

    DllCall(GoToDesktopNumberProc, "Int", num, "Int")
}

move_window_to_desktop(win_id, num) {
    global MoveWindowToDesktopNumberProc, GoToDesktopNumberProc

    DllCall(MoveWindowToDesktopNumberProc, "Ptr", win_id, "Int", num, "Int")
    DllCall(GoToDesktopNumberProc, "Int", num)
}

move_current_window_to_desktop(num) {
    move_window_to_desktop(WinGetID("A"), num)
}

#+r::Reload

; Does not work
#1::goto_desktop(0)
#2::goto_desktop(1)
#3::goto_desktop(2)

#i:: {
    desktop := get_current_desktop_number()

    ; Always returns -1
    MsgBox(("desktop=" . desktop))
}

#t:: {
    win_id := WinGetId("A")
    is_on_desktop := is_window_on_desktop(win_id, 0)

    ; Always returns -1
    MsgBox(("is_on_desktop=" . is_on_desktop))
}

; Does not work
#+1::move_current_window_to_desktop(0)
#+2::move_current_window_to_desktop(1)
#+3::move_current_window_to_desktop(2)

MsgBox("Loaded test user configuration")
levouh commented 8 months ago

Is there a way to verify which version of the .dll I am running? I will try to compare a checksum of one I have versus the latest release on Github to make sure I am indeed on the latest version and/or just re-download the latest.

levouh commented 8 months ago

I swear I did this before, but I apologize as this appears to be user error @Ciantic.

@jmbeach if yours is broken as well, ensure you have the latest version from the Github releases page.

C:\Users\user\AHK>certutil -hashfile .\VirtualDesktopAccessor.dll SHA256
SHA256 hash of .\VirtualDesktopAccessor.dll:
f78ff6334f6c0ef5175ec0819026cec31d421a564b9ed1ee1ac4b6ed98d4f999
CertUtil: -hashfile command completed successfully.

C:\Users\user\AHK>certutil -hashfile .\VirtualDesktopAccessor.dll MD5
MD5 hash of .\VirtualDesktopAccessor.dll:
ccdefc4618ac481f3ce8d11b82ad52b5
CertUtil: -hashfile command completed successfully.
jmbeach commented 8 months ago

Weird. Yeah, not sure which version I had. I thought I had built from source though. I just built from source and it's working again.