Viktor1703
AutoIT Гуру
- Сообщения
- 1,535
- Репутация
- 413
Как можно отличить Button, CheckBox, RadioBox друг от друга, у всех этих элементов класс 'Button'
Код:
#Include <WindowsConstants.au3>
#Include <WinAPIEx.au3>
$hForm = GUICreate('', 800, 600)
$Button1 = GUICtrlCreateButton('Кнопка 1', 10, 20, 80, 20)
$Button2 = GUICtrlCreateButton('Кнопка 2', 10, 50, 80, 20)
GUISetState()
SetControl($hForm)
While 1
Switch GUIGetMsg()
Case -3
Exit
Case $Button1
MsgBox(0, '', 'Кнопка 1')
Case $Button2
MsgBox(0, '', 'Кнопка 2')
EndSwitch
WEnd
Func SetControl($hWnd)
Local $Enum = _WinAPI_EnumChildWindows($hWnd)
For $i = 1 To UBound($Enum) -1
$id = _WinAPI_GetDlgCtrlID($Enum[$i][0])
Local $iPos = ControlGetPos($hWnd, '', $id)
Local $sText = GUICtrlRead($id)
GUICtrlDelete($id)
$id = GUICtrlCreateLabel($sText, $iPos[0], $iPos[1], $iPos[2], $iPos[3])
Next
EndFunc