#include <GuiConstants.au3>
#include <EditConstants.au3>
Opt("GUIOnEventMode", 1)
Dim $Input[3]
$GUI = GUICreate("测试", 140, 130)
GUISetOnEvent($GUI_EVENT_CLOSE, "GUICtrlMsg")
$Input[1] = GUICtrlCreateInput("", 10, 10, 120, 25, BitOR($GUI_SS_DEFAULT_INPUT, $ES_CENTER, $ES_NOHIDESEL, $ES_AUTOVSCROLL, $ES_WANTRETURN))
GUICtrlSetState(-1, $GUI_FOCUS)
$iFOCUS = $Input[1]
GUICtrlSetFont(-1, 12, 200, 0, "宋体")
$Input[2] = GUICtrlCreateInput("", 10, 50, 120, 25, BitOR($GUI_SS_DEFAULT_INPUT, $ES_CENTER, $ES_AUTOVSCROLL, $ES_PASSWORD, $ES_WANTRETURN))
GUICtrlSetFont(-1, 12, 100, 0)
$Button = GUICtrlCreateButton("测试", 10, 90, 120, 30)
GUICtrlSetFont(-1, 16, 400, 0)
GUICtrlSetOnEvent(-1, "GUICtrlMsg")
GUISetState(@SW_SHOW)
GUIRegisterMsg(0x0111, "MY_WM_COMMAND") ;$WM_COMMAND
While 1
Sleep(100)
WEnd
Func GUICtrlMsg()
Switch @GUI_CtrlId;选择事件 ID 或 控件 ID
Case $GUI_EVENT_CLOSE;如果点下的是$GUI_EVENT_CLOSE(关闭)
Exit
Case $Button
MsgBox(0, "", "1#输入框:" & GUICtrlRead($Input[1]) & @LF & @LF & "2#输入框:" & GUICtrlRead($Input[2]))
EndSwitch
EndFunc ;==>GUICtrlMsg
Func MY_WM_COMMAND($hWnd, $Msg, $wParam)
#forceref $hWnd, $iMsg
$nNotifyCode = BitShift($wParam, 16)
$nID = BitAND($wParam, 0x0000FFFF)
If $nID = 1 And $nNotifyCode = 0 Then
GUICtrlSetState($iFOCUS + 1, $GUI_FOCUS)
Return 0
Else
$iFOCUS = $nID
EndIf
Return $GUI_RUNDEFMSG
EndFunc ;==>MY_WM_COMMAND