用 GUIRegisterMsg 捕获WM_COMMAND系统消息并处理EN_CHANGE事件(Edit和Input控件的专有事件),这样就可以实时取出文本内容并更新list控件内容。
请试试这个:#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 194, 111, 192, 114)
$Edit1 = GUICtrlCreateEdit('', 32, 40, 131, 20)
$hEdit = GUICtrlGetHandle($Edit1)
GUIRegisterMsg($WM_COMMAND, 'WM_COMMAND')
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
EndSwitch
WEnd
Func WM_COMMAND($hWnd, $msg, $wParam, $lParam)
Local $iCode = BitShift($wParam, 16) ; get the high word
Switch $lParam
Case $hEdit
Switch $iCode
Case $EN_CHANGE
$text = GUICtrlRead($Edit1)
MsgBox(0, "Contents", $text)
EndSwitch
EndSwitch
Return $GUI_RUNDEFMSG
EndFunc ;==>WM_COMMAND
|