ControlGetPos

콘트롤의 위치와 크기를 열람합니다.

ControlGetPos , OutX, OutY, OutWidth, OutHeight, Control, WinTitle, WinText, ExcludeTitle, ExcludeText

매개변수

OutX, OutY

The names of the output variables in which to store the X and Y coordinates (in pixels) of Control's upper left corner. 이 좌표는 목표 창의 좌상 모서리에 상대적이며 그래서 ControlMove가 사용하는 좌표와 같습니다.

X나 Y를 생략하면, 상응하는 값이 저장되지 않습니다.

OutWidth, OutHeight

The names of the output variables in which to store Control's width and height (in pixels). 생략하면, 상응하는 값이 저장되지 않습니다.

Control

ClassNN (콘트롤의 클래스이름과 실체 번호) 또는 콘트롤의 텍스트일 수 있습니다. 둘 모두 Window Spy로 알아낼 수 있습니다. 텍스트를 사용할 때, 부합하는 행위는 SetTitleMatchMode로 결정됩니다. 이 매개변수가 비어 있으면, 목표 창의 최상위 콘트롤이 사용됩니다.

콘트롤의 HWND (창 핸들)에 작동시키려면, Control 매개변수를 빈 채로 두고 ahk_id %ControlHwnd%WinTitle 매개변수에 지정하십시오 (이것은 숨은 창에도 작동합니다. DetectHiddenWindows가 꺼져 있어도 상관 없습니다). 콘트롤의 HWND는 전형적으로 ControlGet Hwnd, MouseGetPos, 또는 DllCall()을 통하여 열람됩니다.

WinTitle

목표 창을 식별하는 창 제목 또는 다른 기준. WinTitle 참조.

WinText

존재하면, 이 매개변수는 목표 창 텍스트의 부문자열입니다 (동봉된 Window Spy 유틸리티에 노출됨). 숨은 텍스트는 DetectHiddenText가 켜져 있어야 탐지됩니다.

ExcludeTitle

제목에 이 값이 있는 창은 무시합니다.

ExcludeText

텍스트에 이 값이 있는 창은 무시합니다.

논평

부합하는 창이나 콘트롤이 발견되지 않으면, 출력 변수는 비워집니다.

콘트롤을 변경하는 명령어와 다르게, ControlGetPos는 자동 지연이 없습니다 (SetControlDelay에 영향을 받지 않습니다).

현재 마우스가 떠 있는 콘트롤의 ClassNN 또는 HWND를 발견하려면, MouseGetPos를 사용하십시오. 창의 모든 콘트롤 목록을 열람하려면, WinGet ControlList를 사용하십시오.

창 제목과 텍스트는 대소문자를 구분합니다. 숨은 창은 DetectHiddenWindows가 켜져 있어야 탐지됩니다.

ControlMove, WinGetPos, Control, ControlGet, ControlGetText, ControlSetText, ControlClick, ControlFocus, ControlSend

예제

Continuously updates and displays the name and position of the control currently under the mouse cursor.

Loop
{
    Sleep, 100
    MouseGetPos, , , WhichWindow, WhichControl
    ControlGetPos, x, y, w, h, %WhichControl%, ahk_id %WhichWindow%
    ToolTip, %WhichControl%`nX%X%`tY%Y%`nW%W%`t%H%
}