ControlGetPos
获取控件相对其窗口的坐标位置和大小.
ControlGetPos ( "title", "text", controlID )
参数
title
|
目标窗口标题, 或句柄, 或类名. 参考窗口标题与文本(高级).
|
text
|
目标窗口文本. 参见 窗口标题与文本
|
controlID
|
控件标识符. 相关说明见 控件.
|
返回值
成功:
|
返回控件相对其窗口位置及大小的数组:
$aArray[0] = X 坐标
$aArray[1] = Y 坐标
$aArray[2] = 宽度
$aArray[3] = 高度
|
失败:
|
设置 @error 为 1.
|
备注
窗口标题/文本会涉及到父窗口及可能不包含控件 ID 的活动窗口,请小心使用定义参数.
函数示例
#include <MsgBoxConstants.au3>
Example()
Func Example()
; Run Notepad
Run("notepad.exe")
; Wait 10 seconds for the Notepad window to appear.
Local $hWnd = WinWait("[CLASS:Notepad]", "", 10)
; Retrieve the position x, y and size (width and height) of the edit control in Notepad. The handle returned by WinWait is used for the "title" parameter of ControlGetPos.
Local $aPos = ControlGetPos($hWnd, "", "Edit1")
; Display the position and size of the edit control.
MsgBox($MB_SYSTEMMODAL, "", "Position: " & $aPos[0] & ", " & $aPos[1] & @CRLF & "Size: " & $aPos[2] & ", " & $aPos[3])
; Close the Notepad window using the handle returned by WinWait.
WinClose($hWnd)
EndFunc ;==>Example
----------------------------------------
该函数可以通过命令 exect 调用
参见:
ControlMove, ControlCommand
tcimg=$cm498 pause=500 exect=$var_array=ControlGetPos('[CLASS:TBUTTONCHANGEDLG]','''','TListBox2')||_ViewValues($var_array) ;; 调用工具栏并获取数组指定元素的坐标(TC x32)
© Аверин Андрей для Total Commander Image Averin-And@yandex.ru
|