Window Spy suspends updates over AHK Gui windows during debug breakpoint

Get help with using AutoHotkey (v2 or newer) and its commands and hotkeys
SAbboushi
Posts: 252
Joined: 08 Dec 2014, 22:13

Window Spy suspends updates over AHK Gui windows during debug breakpoint

Post by SAbboushi » 16 Jan 2024, 12:33

Code: Select all

MyGui := Gui()
MyGui.Add("Text",, "Please enter your name:")
MyGui.AddEdit("vName")
MyGui.Show
"Busy" mouse pointer is displayed when pointer is above AHK Gui window and updates are suspended
image.png
image.png (748.45 KiB) Viewed 364 times
Is there a workaround for using Window Spy for AHKv2 for AHK Gui's (or do I have to use another tool like AutoIt Control Viewer or Microsoft Spy++)?
Last edited by SAbboushi on 16 Jan 2024, 13:10, edited 1 time in total.

User avatar
mikeyww
Posts: 26991
Joined: 09 Sep 2014, 18:38

Re: Window Spy suspends updates over AHK Gui windows

Post by mikeyww » 16 Jan 2024, 12:58

No problems here. No spinning; nothing strange. I ran your script verbatim. Could try disabling your antivirus during the test.

I'm running v2.0.11 on Win 11 Pro.

SAbboushi
Posts: 252
Joined: 08 Dec 2014, 22:13

Re: Window Spy suspends updates over AHK Gui windows

Post by SAbboushi » 16 Jan 2024, 13:03

Appreciate you taking the time and my apologies... I just realized it only happens during debugging.
So to clarify, is there a workaround for using Window Spy for AHKv2 for AHK Gui's when script is stopped at a breakpoint while debugging? Not a problem for the other tools I mentioned

User avatar
mikeyww
Posts: 26991
Joined: 09 Sep 2014, 18:38

Re: Window Spy suspends updates over AHK Gui windows

Post by mikeyww » 16 Jan 2024, 13:07

I do not know; no breakpoints here! Others can chime in with some advice.

SAbboushi
Posts: 252
Joined: 08 Dec 2014, 22:13

Re: Window Spy suspends updates over AHK Gui windows during debug breakpoint

Post by SAbboushi » 16 Jan 2024, 13:11

(edited title re: relates to debugging)

SAbboushi
Posts: 252
Joined: 08 Dec 2014, 22:13

Re: Window Spy suspends updates over AHK Gui windows during debug breakpoint

Post by SAbboushi » 16 Jan 2024, 13:31

Only "workaround" I've found is to use Pause which is fine when not using a debugger but to me defeats the purpose of using a debugger (having to modify the code to add Pause commands and then restart the script in the debugger...)

SAbboushi
Posts: 252
Joined: 08 Dec 2014, 22:13

Re: Window Spy suspends updates over AHK Gui windows during debug breakpoint

Post by SAbboushi » 17 Jan 2024, 17:33

Owtch... 😳😳 my sincere apologies to @Lexicos and the team for my completely ignorant claim that Window Spy for AHKv2 has a problem and that the other tools I mentioned do not. If anything, it is the other way around!

My current findings/suspicions: when a script is stopped due to a breakpoint in the debugger, it becomes unresponsive as far as Windows is concerned. In order to make it possible for a user to minimize, move, or close the main window of an application that is not responding, Windows implemented Window Ghosting in the Windows Manager which captures whatever it can from the unresponsive window on the screen and creates a new ghost window (class 'ghost').
Although Spy++ and CV detect and return info from the ghost window, the property values can be misleading (as they were to me) e.g. HWND is for the ghost window, not the Gui window I am debugging.

So Windows Spy essentially ignoring the ghost window has its advantages

HWND of actual Gui window I'm debugging: 91D4A
HWND of Ghost Window: A1D9C
image.png
image.png (63.46 KiB) Viewed 252 times
More info:
https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-disableprocesswindowsghosting
https://www.autoitscript.com/forum/topic/79222-ghost-class-window/?do=findComment&comment=571362

Would appreciate if any more knowledgeable can comment/confirm I've got that right and that the only way to get the correct property values from a "Spy" tool during debugging is by pausing the script

lexikos
Posts: 9593
Joined: 30 Sep 2013, 04:07
Contact:

Re: Window Spy suspends updates over AHK Gui windows during debug breakpoint

Post by lexikos » 19 Jan 2024, 23:40

You can disable the ghosting feature in your application via a call to DisableProcessWindowsGhosting ()
Source: Preventing Hangs in Windows Applications - Win32 apps | Microsoft Learn

Post Reply

Return to “Ask for Help (v2)”