#include <Array.au3>
#include <WinAPIEx.au3>
$sClass = 'Button'
$j = 0
Run(@SystemDir & '\calc.exe')
$hWin = WinWait('[Class:SciCalc]', '', 3)
If Not $hWin Then Exit
$aData = _WinAPI_EnumChildWindows($hWin, 0)
If @error Then Exit
Dim $aResult[$aData[0][0] + 1][6]
For $i = 1 To $aData[0][0]
If $aData[$i][1] == $sClass Then
$j += 1
$aResult[$j][0] = '[CLASS:' & $aData[$i][1] & '; INSTANCE:' & $j & ']'
$aResult[$j][1] = $aData[$i][0]
$aResult[$j][2] = _WinAPI_GetDlgCtrlID($aData[$i][0])
$aTemp = ControlGetPos($hWin, '', $aData[$i][0])
If Not @error Then
For $q = 0 To 1
$aResult[$j][$q + 3] = $aTemp[$q]
Next
EndIf
$aResult[$j][5] = ControlGetText($hWin, '', $aResult[$j][1])
EndIf
Next
ReDim $aResult[$j + 1][6]
$aResult[0][0] = 'Class name + INSTANCE'
$aResult[0][1] = 'Handle'
$aResult[0][2] = 'ID'
$aResult[0][3] = 'X'
$aResult[0][4] = 'Y'
$aResult[0][5] = 'Text'
_ArrayDisplay($aResult, $sClass)
;3-ий параметр функции ControlMove():
If WinExists($hWin) Then
For $i = 1 To $j
ControlMove($hWin, '', $aResult[$i][1], $aResult[$j - ($i - 1)][3], $aResult[$j - ($i - 1)][4]);Handle
Next
_WinAPI_RedrawWindow($hWin)
MsgBox(64, 'Info', 'Используем Handle')
EndIf
If WinExists($hWin) Then
For $i = 1 To $j
ControlMove($hWin, '', $aResult[$i][2], $aResult[$i][3], $aResult[$i][4]);ID
Next
_WinAPI_RedrawWindow($hWin)
MsgBox(64, 'Info', 'Используем ID')
EndIf
If WinExists($hWin) Then
For $i = 1 To $j
ControlMove($hWin, '', $aResult[$i][0], $aResult[$j - ($i - 1)][3], $aResult[$j - ($i - 1)][4]);[CLASS:Button; INSTANCE:n]
Next
_WinAPI_RedrawWindow($hWin)
MsgBox(64, 'Info', 'Используем [CLASS:Button; INSTANCE:n]')
EndIf
If WinExists($hWin) Then
$iR = Random(0, 2, 1)
For $i = 1 To $j
ControlMove($hWin, '', $aResult[$i][$iR], $aResult[$i][3], $aResult[$i][4]);???
Next
_WinAPI_RedrawWindow($hWin)
MsgBox(64, 'Info', 'Вернули все на место :)')
EndIf