[v2.0.18] WinExist ignores DetectHiddenWindows settings. Topic is solved

Share your ideas as to how the documentation can be improved.
User avatar
RaptorX
Posts: 436
Joined: 06 Dec 2014, 14:27
Contact:

[v2.0.18] WinExist ignores DetectHiddenWindows settings.

Post by RaptorX » 28 Nov 2024, 23:46

Hello,

According to the help file:
DetectHiddenWindows wrote: If false, hidden windows are not detected, except by the WinShow function.
Also:
WinExist wrote: Window titles and text are case-sensitive. By default, hidden windows are not detected and hidden text elements are detected, unless changed with DetectHiddenWindows and DetectHiddenText.
So the behavior shown here is unexpected to me:

Code: Select all

DetectHiddenWindows false
main := Gui()

MsgBox WinExist(main) ; A handle is shown
This doesnt happen with WinWait for example:

Code: Select all

DetectHiddenWindows false
main := Gui()

WinWait(main) ; This stays waiting for the window to exist and enters an infinite wait...
MsgBox 'Window Found'
Other Win functions seem to be affected as well:

Code: Select all

DetectHiddenWindows false
main := Gui()

MsgBox WinGetPID(main) ; displays a pid

v1 Doesnt seem to be affected by this issue:

Code: Select all

DetectHiddenWindows 0
Gui, New,, My Window
; Gui Show, w300 h300

WinGet, PID, PID, My Window
MsgBox %PID% ; this returns empty unless the line above is uncommented
Projects:
AHK-ToolKit

just me
Posts: 9871
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: [v2.0.18] WinExist ignores DetectHiddenWindows settings.

Post by just me » 29 Nov 2024, 02:29

ahk_id (Unique ID / HWND)
Use ahk_id HWND or a pure HWND (as an Integer or an Object with a HWND property) in WinTitle to identify a window or control by its unique ID.

When using ahk_id HWND, DetectHiddenWindows affects whether hidden top-level windows are detected, but hidden controls are always detected. When using pure HWNDs, hidden windows are always detected regardless of DetectHiddenWindows. WinWait and WinWaitClose are an exception, where both ahk_id HWND and pure HWNDs are affected by DetectHiddenWindows.
Not easy to find! ;)

User avatar
RaptorX
Posts: 436
Joined: 06 Dec 2014, 14:27
Contact:

Re: [v2.0.18] WinExist ignores DetectHiddenWindows settings.

Post by RaptorX » 29 Nov 2024, 08:39

just me wrote:
29 Nov 2024, 02:29
ahk_id (Unique ID / HWND)
Use ahk_id HWND or a pure HWND (as an Integer or an Object with a HWND property) in WinTitle to identify a window or control by its unique ID.

When using ahk_id HWND, DetectHiddenWindows affects whether hidden top-level windows are detected, but hidden controls are always detected. When using pure HWNDs, hidden windows are always detected regardless of DetectHiddenWindows. WinWait and WinWaitClose are an exception, where both ahk_id HWND and pure HWNDs are affected by DetectHiddenWindows.
Not easy to find! ;)
WOW interesting find. The examples are passing the full object (which I understand is being translated to getting their hwnd property) but that exception should probably be a little bit more visible on the help file. I guess, Ill send that suggestion to the person maintaining the help file.
Projects:
AHK-ToolKit

User avatar
Ragnar
Posts: 831
Joined: 30 Sep 2013, 15:25

Re: [v2.0.18] WinExist ignores DetectHiddenWindows settings.  Topic is solved

Post by Ragnar » 29 Nov 2024, 14:37

I've moved this topic from Bug Reports to Suggestions on Documentation Improvements.

Some docs have been updated regarding this. See PR #721 on GitHub for details.

User avatar
RaptorX
Posts: 436
Joined: 06 Dec 2014, 14:27
Contact:

Re: [v2.0.18] WinExist ignores DetectHiddenWindows settings.

Post by RaptorX » 29 Nov 2024, 17:01

Ragnar wrote:
29 Nov 2024, 14:37
I've moved this topic from Bug Reports to Suggestions on Documentation Improvements.

Some docs have been updated regarding this. See PR #721 on GitHub for details.
Perfect, I will update others as I access them if possible, cause this one was a head scratcher for a bit :)
Projects:
AHK-ToolKit

Post Reply

Return to “Suggestions on Documentation Improvements”