aptyp
Новичок
- Сообщения
- 36
- Репутация
- 0
Как получить Control ID кнопок окна
$GUI_EVENT_CLOSE
$GUI_EVENT_MINIMIZE
$GUI_EVENT_RESTORE
$GUI_EVENT_CLOSE
$GUI_EVENT_MINIMIZE
$GUI_EVENT_RESTORE
Код:
#include <GUIConstantsEx.au3>
#include <WinAPIDlg.au3>
$Form1 = GUICreate("Форма 1")
$Button1 = GUICtrlCreateButton("Да", 140, 125, 50, 50)
$Button2 = GUICtrlCreateButton("Нет", 190, -1, 50, 50)
GUISetState(@SW_SHOW)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
MsgBox(0, 0, "ID=" & _WinAPI_GetDlgCtrlID(ControlGetHandle($Form1, "", $GUI_EVENT_CLOSE)) & " WinHandle=" & WinGetHandle($Form1) & " CtrlHandle=" & GUICtrlGetHandle($GUI_EVENT_CLOSE))
Exit
Case $GUI_EVENT_MINIMIZE
MsgBox(0, 0, "ID=" & _WinAPI_GetDlgCtrlID(GUICtrlGetHandle($GUI_EVENT_MINIMIZE)) & " WinHandle=" & WinGetHandle($Form1) & " CtrlHandle=" & GUICtrlGetHandle($GUI_EVENT_MINIMIZE))
Case $GUI_EVENT_RESTORE
MsgBox(0, 0, "ID=" & _WinAPI_GetDlgCtrlID(GUICtrlGetHandle($GUI_EVENT_RESTORE)) & " WinHandle=" & WinGetHandle($Form1) & " CtrlHandle=" & GUICtrlGetHandle($GUI_EVENT_RESTORE))
Case $Button1
MsgBox(0, 0, "ID=" & _WinAPI_GetDlgCtrlID(GUICtrlGetHandle($Button1)) & " WinHandle=" & WinGetHandle($Form1) & " CtrlHandle=" & GUICtrlGetHandle($Button1))
Case $Button2
MsgBox(0, 0, "ID=" & _WinAPI_GetDlgCtrlID(GUICtrlGetHandle($Button2)) & " WinHandle=" & WinGetHandle($Form1) & " CtrlHandle=" & GUICtrlGetHandle($Button2))
EndSwitch
WEnd