Determines whether invisible windows are "seen" by the script.
DetectHiddenWindows, On|Off |
Parameters
On|Off | On: Hidden windows are detected. Off: This is the default. Hidden windows are not detected, except by the WinShow command. |
Remarks
Turning on DetectHiddenWindows can make scripting harder in some cases since some hidden system windows might accidentally match the title or text of another window you're trying to work with. So most scripts should leave this setting turn off. However, turning it on may be useful if you wish to work with hidden windows directly without first using WinShow to unhide them.
All windowing commands except WinShow are affected by this setting, including WinActivate, IfWinActive, WinWait, IfWinExist. In other words, WinShow will always unhide a hidden window even if hidden windows are not being detected.
The built-in variable A_DetectHiddenWindows contains the current setting (On or Off).
In v1.0.40.05+, a child window (control) may be accessed via the ahk_id method even when hidden; that is, the setting of DetectHiddenWindows does not matter.
Every newly launched thread (such as a hotkey, custom menu item, or timed subroutine) starts off fresh with the default setting for this command. That default may be changed by using this command in the auto-execute section (top part of the script).
Related
Example
DetectHiddenWindows, on