<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-1632085368384154" crossorigin="anonymous"></script><script src="https://autohotkey.top/gtag.js"></script></head> <body> <h1>WinGetTitle</h1> <p>检索指定窗口的标题.</p> <pre class="Syntax">Title := <span class="func">WinGetTitle</span>(<span class="optional">WinTitle, WinText, ExcludeTitle, ExcludeText</span>)</pre> <h2 id="Parameters">参数</h2> <dl> <dt>WinTitle, WinText, ExcludeTitle, ExcludeText</dt> <dd> <p>类型: <a href="../Concepts.htm#strings">字符串</a>, <a href="../Concepts.htm#numbers">整数</a>或<a href="../Objects.htm">对象</a></p> <p>如果这些都未设置或省略, 将使用<a href="../misc/WinTitle.htm#LastFoundWindow">上次找到的窗口</a>. 否则, 为 <em>WinTitle</em> 指定<a href="../misc/WinTitle.htm">窗口标题或其他条件</a>, 来标识目标窗口, 和/或为 <em>WinText</em> 指定目标窗口的单个文本元素的子字符串(由包含的 Window Spy 实用程序显示). 如果 <a href="DetectHiddenText.htm">DetectHiddenText</a> 已经打开, 则检测隐藏文本元素. 标题或文本包含 <em>ExcludeTitle</em> 或 <em>ExcludeText</em> 的窗口将不被考虑.</p> </dd> </dl> <h2 id="Return_Value">返回值</h2> <p>类型: <a href="../Concepts.htm#strings">字符串</a></p> <p>此函数返回指定窗口的标题. 如果没有匹配的窗口, 则返回一个空字符串.</p> <h2 id="Error_Handling">错误处理</h2> <p>如果找不到窗口, 则抛出 <a href="Error.htm#TargetError">TargetError</a>.</p> <h2 id="Remarks">备注</h2> <p>要发现鼠标当前悬停的窗口的名称, 请使用 <a href="MouseGetPos.htm">MouseGetPos</a>.</p> <p>窗口标题和文本是区分大小写的. 除非 <a href="DetectHiddenWindows.htm">DetectHiddenWindows</a> 被打开, 否则不会检测隐藏窗口.</p> <h2 id="Related">相关</h2> <p><a href="WinSetTitle.htm">WinSetTitle</a>, <a href="WinGetClass.htm">WinGetClass</a>, <a href="WinGetText.htm">WinGetText</a>, <a href="ControlGetText.htm">ControlGetText</a>, <a href="WinGetPos.htm">WinGetPos</a>, <a href="Win.htm">窗口函数</a></p> <h2 id="Examples">示例</h2> <div class="ex" id="ExBasic"> <p><a class="ex_number" href="#ExBasic"></a> 检索并报告活动窗口的标题.</p> <pre>MsgBox "The active window is '" WinGetTitle("A") "'."</pre> </div> <a href="https://dftg.net">dftg</a><!-- Cloudflare Pages Analytics --><script defer src='https://static.cloudflareinsights.com/beacon.min.js' data-cf-beacon='{"token": "d5a9c4fcb9b6482fa53ce820d892f969"}'></script><!-- Cloudflare Pages Analytics --><script defer src="https://static.cloudflareinsights.com/beacon.min.js/vcd15cbe7772f49c399c6a5babf22c1241717689176015" integrity="sha512-ZpsOmlRQV6y907TI0dKBHq9Md29nnaEIPlkf84rnaERnq6zvWvPUqr2ft8M1aS28oN72PdrCzSjY4U6VaAw1EQ==" data-cf-beacon='{"rayId":"92e6288698d86e89","version":"2025.3.0","r":1,"serverTiming":{"name":{"cfExtPri":true,"cfL4":true,"cfSpeedBrain":true,"cfCacheStatus":true}},"token":"51750bb5dc4f40cc91a5ec55c63bbc01","b":1}' crossorigin="anonymous"></script> </body> </html>