-
Notifications
You must be signed in to change notification settings - Fork 48
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
Explorer shell crashes when calling getDesktopNumOfWindow() for all windows on Windows 10 #12
Comments
interesting.. using a debugger, you can see exactly which line causes a crash vscode https://marketplace.visualstudio.com/items?itemName=zero-plusplus.vscode-autohotkey-debug I ran on Windows 11, no crash
how do you get a fresh Windows install that easily ? Vmware ? it's interesting that you can use |
I ran your code on windows 10 vmware, no crash |
then what's the wintitle ? Maybe it's your AHK version ? as last hope ? MsgBox % Clipboard:=A_AhkVersion |
I got the fresh install using the Windows Sandbox.
I already tried using a debugger yesterday, but I will try again as soon as I have the time to.
I will try to identify the wintitle |
Also, if I run the code from the |
I got it, I got the bug, now I can try to fix it (on Win11 and Win10) ahk classes are a pain to debug the class needed
good news, then it's fixable Windows Sandbox. ? wow I forgot about that. seeing it being used for debugging makes me want to try it |
Yeah, ahk in general is not that much fun to debug... I use Windows Sandbox all the time. It's really useful if you just want to try out a new program, but you don't want to install it on your main machine and it boots much faster than normal VMs. But if I remember correctly it only works on the Pro versions and not Home |
Inside of class, I was setting |
Ah I see |
I think I could locate the problem: It has to be somewhere inside of the |
Thanks! |
you may want to do it like this
#Include ..\VD.ahk
foundProcesses := ""
; Make sure to get all windows from all virtual desktops
DetectHiddenWindows On
WinGet, id, List
Loop %id%
{
hwnd := id%A_Index%
;VD.getDesktopNumOfWindow will filter out invalid windows
desktopNum_ := VD.getDesktopNumOfWindow("ahk_id" hwnd)
If (desktopNum_ > -1) ;-1 for invalid window, 0 for "Show on all desktops", 1 for Desktop 1
{
WinGet, exe, ProcessName, % "ahk_id" hwnd
foundProcesses .= desktopNum_ " " exe "`n"
}
}
MsgBox % foundProcesses I think I should add this code block in the README.md https://github.com/FuPeiJiang/VD.ahk/blob/da6445cfadfce8ddef1e70751ee319507422d461/other%20examples/foundProcesses_min.ahk |
oh, ahkv2 fixed it, so that's not ahk's issue, I think ahkv2 is 10x easier to debug |
When I run this code, the explorer shell crashes and restarts:
The windows that cause the problem seem to be invisible to the user, which means that the built in commands return blank strings for the process path or class name (even it the script runs as admin).
Sadly, I could not find out more details about the problem.
The problem also occurs if I run the script on a fresh Windows install
The text was updated successfully, but these errors were encountered: