</head> <body> <h1>DetectHiddenWindows</h1> <p>Determines whether invisible windows are "seen" by the script.</p> <pre class="Syntax"><span class="func">DetectHiddenWindows</span>, OnOff</pre> <h2 id="Parameters">Parameters</h2> <dl> <dt>OnOff</dt> <dd><p><strong>On</strong>: Hidden windows are detected.</p> <p><strong>Off</strong>: This is the default. Hidden windows are not detected, except by the <a href="WinShow.htm">WinShow</a> command.</p> <p><span class="ver">[v1.1.30+]:</span> The decimal values 1 and 0 may be used in place of On and Off, respectively.</p> </dd> </dl> <h2 id="Remarks">Remarks</h2> <p>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 turned off. However, turning it on may be useful if you wish to work with hidden windows directly without first using <a href="WinShow.htm">WinShow</a> to unhide them.</p> <p>All windowing commands, built-in functions and control flow statements except <a href="WinShow.htm">WinShow</a> are affected by this setting, including <a href="WinActivate.htm">WinActivate</a>, <a href="WinActive.htm">WinActive()</a>, <a href="IfWinActive.htm">IfWinActive</a>, <a href="WinWait.htm">WinWait</a>, <a href="WinExist.htm">WinExist()</a>, <a href="IfWinExist.htm">IfWinExist</a>. By contrast, <a href="WinShow.htm">WinShow</a> will always unhide a hidden window even if hidden windows are not being detected.</p> <p>Turning on DetectHiddenWindows is not necessary when accessing a control or child window via the <a href="../misc/WinTitle.htm#ahk_id">ahk_id method</a> or as the <a href="../misc/WinTitle.htm#LastFoundWindow">last-found-window</a>. It is also not necessary when accessing GUI windows via <code>Gui +<a href="Gui.htm#LastFound">LastFound</a></code>.</p> <p><span class="ver">[v1.1.32+]:</span> Cloaked windows are also considered hidden. Cloaked windows, introduced with Windows 8, are windows on a non-active virtual desktop or UWP apps which have been suspended to improve performance, or more precisely to reduce their memory consumption. On Windows 10, the processes of those are indicated with a green leaf in the Task Manager. Such windows are hidden from view, but might still have the WS_VISIBLE window style. Prior to v1.1.32, all windows with the WS_VISIBLE style were considered visible.</p> <p>The built-in variable <strong>A_DetectHiddenWindows</strong> contains the current setting (On or Off).</p> <p>Every newly launched <a href="../misc/Threads.htm">thread</a> (such as a <a href="../Hotkeys.htm">hotkey</a>, <a href="Menu.htm">custom menu item</a>, or <a href="SetTimer.htm">timed</a> 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).</p> <h2 id="Related">Related</h2> <p><a href="DetectHiddenText.htm">DetectHiddenText</a></p> <h2 id="Examples">Examples</h2> <div class="ex" id="ExBasic"> <p><a class="ex_number" href="#ExBasic"></a> Turns on the detection of hidden windows.</p> <pre>DetectHiddenWindows, On</pre> </div> </body> </html>