</head> <body> <h1>WinGetPos</h1> <p>Retrieves the position and size of the specified window.</p> <pre class="Syntax"><span class="func">WinGetPos</span> <span class="optional">, OutX, OutY, OutWidth, OutHeight, WinTitle, WinText, ExcludeTitle, ExcludeText</span></pre> <h2 id="Parameters">Parâmetros</h2> <dl> <dt>OutX, OutY</dt> <dd><p>The names of the output variables in which to store the X and Y coordinates of the target window's upper left corner. If omitted, the corresponding values will not be stored.</p></dd> <dt>OutWidth, OutHeight</dt> <dd><p>The names of the output variables in which to store the width and height of the target window. If omitted, the corresponding values will not be stored.</p></dd> <dt>WinTitle</dt> <dd><p>A window title or other criteria identifying the target window. See <a href="../misc/WinTitle.htm">WinTitle</a>.</p></dd> <dt>WinText</dt> <dd><p>If present, this parameter must be a substring from a single text element of the target window (as revealed by the included Window Spy utility). Hidden text elements are detected if <a href="DetectHiddenText.htm">DetectHiddenText</a> is ON.</p></dd> <dt>ExcludeTitle</dt> <dd><p>Windows whose titles include this value will not be considered.</p></dd> <dt>ExcludeText</dt> <dd><p>Windows whose text include this value will not be considered.</p></dd> </dl> <h2 id="Remarks">Remarks</h2> <p>If no matching window is found, the output variables will be made blank.</p> <p>If the <em>WinTitle</em> "Program Manager" is used, the command will retrieve the size of the desktop, which is usually the same as the current screen resolution.</p> <p>A minimized window will still have a position and size. The values returned in this case may vary depending on OS and configuration.</p> <p>To discover the name of the window and control that the mouse is currently hovering over, use <a href="MouseGetPos.htm">MouseGetPos</a>.</p> <p>Window titles and text are case sensitive. Hidden windows are not detected unless <a href="DetectHiddenWindows.htm">DetectHiddenWindows</a> has been turned on.</p> <p>On systems with multiple screens which have different DPI settings, the returned position and size may be different than expected due to <a href="../misc/DPIScaling.htm">OS DPI scaling</a>.</p> <h2 id="Related">Tópicos relacionados</h2> <p><a href="WinMove.htm">WinMove</a>, <a href="ControlGetPos.htm">ControlGetPos</a>, <a href="WinGetActiveStats.htm">WinGetActiveStats</a>, <a href="WinGetActiveTitle.htm">WinGetActiveTitle</a>, <a href="WinGetTitle.htm">WinGetTitle</a>, <a href="WinGetText.htm">WinGetText</a>, <a href="ControlGetText.htm">ControlGetText</a></p> <h2 id="Examples">Exemplos</h2> <div class="ex" id="ExBasic"> <p><a class="ex_number" href="#ExBasic"></a> Retrieves and reports the position and size of the calculator.</p> <pre>WinGetPos, X, Y, W, H, Calculator MsgBox, Calculator is at %X%`,%Y% and its size is %W%x%H%</pre> </div> <div class="ex" id="ExA"> <p><a class="ex_number" href="#ExA"></a> Retrieves and reports the position of the active window.</p> <pre>WinGetPos, X, Y,,, A MsgBox, The active window is at %X%`,%Y%</pre> </div> <div class="ex" id="ExLastFound"> <p><a class="ex_number" href="#ExLastFound"></a> If Notepad does exist, retrieve and report its position.</p> <pre>if WinExist("Sem título - Notepad") { WinGetPos, Xpos, Ypos <em>; Use the window found by WinExist.</em> MsgBox, Notepad is at %Xpos%`,%Ypos% }</pre> </div> </body> </html>