</head> <body> <h1>MonitorGet</h1> <p>检查指定的监视器是否存在, 并可选地检索其边界坐标.</p> <pre class="Syntax">ActualN := <span class="func">MonitorGet</span>(<span class="optional">N, &amp;Left, &amp;Top, &amp;Right, &amp;Bottom</span>)</pre> <h2 id="Parameters">参数</h2> <dl> <dt>N</dt> <dd> <p>类型: <a href="../Concepts.htm#numbers">整数</a></p> <p>如果省略, 则使用主监视器. 否则, 请指定监视器编号, 介于 1 和 <a href="MonitorGetCount.htm">MonitorGetCount</a> 返回的数字之间.</p> </dd> <dt>&amp;Left, &amp;Top, &amp;Right, &amp;Bottom</dt> <dd> <p>类型: <a href="../Concepts.htm#variable-references">VarRef</a></p> <p>如果省略, 将不会存储相应的值. 否则, 请指定储存边界坐标(以像素为单位) 的变量的引用.</p> </dd> </dl> <h2 id="Return_Value">返回值</h2> <p>类型: <a href="../Concepts.htm#numbers">整数</a></p> <p>该函数返回显示器编号(与 <em>N</em> 相同, 除非省略 <em>N</em>).</p> <h2 id="Error_Handling">错误处理</h2> <p>失败时抛出异常, 输出变量不会被修改.</p> <h2 id="Remarks">备注</h2> <p>内置变量 <a href="../Variables.htm#Screen">A_ScreenWidth</a> 和 <a href="../Variables.htm#Screen">A_ScreenHeight</a> 包含主监视器的尺寸(以像素为单位).</p> <p>可以使用 <a href="SysGet.htm">SysGet</a> 检索所有显示监视器的边框. 例如, 它检索虚拟屏幕的宽度和高度:</p> <pre>MsgBox SysGet(78) " x " SysGet(79)</pre> <h2 id="Related">相关</h2> <p><a href="MonitorGetWorkArea.htm">MonitorGetWorkArea</a>, <a href="SysGet.htm">SysGet</a>, <a href="Monitor.htm">监视器函数</a></p> <h2 id="Examples">示例</h2> <div class="ex" id="ExBasic"> <p><a class="ex_number" href="#ExBasic"></a> 在消息框中显示监视器 #2 的边界坐标.</p> <pre> <pre>try { MonitorGet 2, &amp;Left, &amp;Top, &amp;Right, &amp;Bottom MsgBox "Left: " Left " -- Top: " Top " -- Right: " Right " -- Bottom: " Bottom } catch MsgBox "Monitor 2 doesn't exist or an error occurred."</pre> </div> <p>有关此函数的演示, 请参阅<a href="Monitor.htm">监视器函数</a>页面的<a href="Monitor.htm#ExLoopAll">示例 #1</a>.</p> </body> </html>