문서 편집 권한이 없습니다. 다음 이유를 확인해주세요:
요청한 명령은 다음 권한을 가진 사용자에게 제한됩니다: 사용자.
== Handle의 class instance 값 구하는 방법 == * AutoIt에서 핸들을 통해 특정 컨트롤의 클래스 인스턴스 값을 구하려면 ControlGetHandle 또는 WinGetHandle을 사용해 윈도우나 컨트롤의 핸들을 얻은 후, DllCall을 통해 Windows API를 호출하여 인스턴스 값을 얻을 수 있습니다. * 예를 들어, GetClassName 함수를 통해 컨트롤의 클래스 이름을 얻고, 이를 활용하여 인스턴스 값을 구할 수 있습니다. * AutoIt에서 DllCall을 사용해 클래스 이름을 가져오는 예제 <source lang=autoit> #include <WinAPI.au3> ; 윈도우 핸들 얻기 Local $hWnd = WinGetHandle("Window Title") ; "Window Title"을 실제 윈도우 제목으로 변경 ; 컨트롤 핸들 얻기 Local $hControl = ControlGetHandle($hWnd, "", "[CLASS:Edit; INSTANCE:1]") ; 클래스와 인스턴스를 지정하여 컨트롤 핸들 가져오기 ; 컨트롤 핸들 유효성 검사 If Not IsHWnd($hControl) Then MsgBox(16, "Error", "Could not get control handle.") Exit EndIf ; 클래스 이름 버퍼 생성 Local $sClassName = DllStructCreate("char[256]") DllCall("user32.dll", "int", "GetClassName", "hwnd", $hControl, "ptr", DllStructGetPtr($sClassName), "int", 256) ; 클래스 이름 가져오기 Local $sClass = DllStructGetData($sClassName, 1) ConsoleWrite("Class Name: " & $sClass & @CRLF) ; 인스턴스 가져오기 Local $iInstance = _GetControlInstance($hWnd, $sClass) ConsoleWrite("Instance: " & $iInstance & @CRLF) ; 함수: 주어진 핸들에서 클래스 이름의 인스턴스 번호 찾기 Func _GetControlInstance($hWnd, $sClassName) Local $iCount = 0 Local $hChild = _WinAPI_FindWindowEx($hWnd, 0, $sClassName, "") While $hChild $iCount += 1 If $hChild = $hControl Then Return $iCount $hChild = _WinAPI_FindWindowEx($hWnd, $hChild, $sClassName, "") WEnd Return 0 ; 인스턴스를 찾지 못한 경우 EndFunc </source> == [class instance:1 ] 값이 변경 될때 찾는 방법 == <source lang=autoit> #include <MsgBoxConstants.au3> ; 현재 활성 창 핸들 가져오기 Local $hActiveWindow = WinGetHandle("[ACTIVE]") ; 목표 컨트롤의 클래스 이름 Local $sClassName = "Edit" ; 모든 인스턴스를 탐색하여 원하는 컨트롤 찾기 For $i = 1 To 9 ; INSTANCE 1 ~ 9 탐색 Local $sControl = "[CLASS:" & $sClassName & "; INSTANCE:" & $i & "]" Local $hControl = ControlGetHandle($hActiveWindow, "", $sControl) ; 컨트롤이 유효한지 확인 If IsHWnd($hControl) Then ; 컨트롤 정보 가져오기 Local $sControlText = ControlGetText($hActiveWindow, "", $sControl) MsgBox($MB_ICONINFORMATION, "Control Found", "Instance: " & $i & @CRLF & "Control Text: " & $sControlText) ExitLoop ; 컨트롤을 찾았으므로 종료 EndIf Next ; 컨트롤을 찾지 못한 경우 If $hControl = 0 Then MsgBox($MB_ICONERROR, "Error", "No matching control found.") EndIf </source> [[category:autoit]]
문서 저장 미리 보기 차이 보기 취소