#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <EditConstants.au3>
Global $hGUI, $idEdit, $idBtn, $idDummy, $iCountLines
GUIRegisterMsg($WM_COMMAND, '_WM_COMMAND')
$hGUI = GUICreate('Edit', 200, 200)
$idEdit = GUICtrlCreateEdit('', 20, 20, 160, 100)
$idBtn = GUICtrlCreateButton('Test', 50, 145, 100, 30)
$idDummy = GUICtrlCreateDummy()
GUISetState()
$iCountLines = GUICtrlSendMsg($idEdit, $EM_GETLINECOUNT, 0, 0)
While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
Exit
Case $idBtn
MsgBox(64, 'Info', 'Btn click', 0, $hGUI)
Case $idDummy
MsgBox(64, 'Info', 'You send Enter in Edit', 0, $hGUI)
EndSwitch
WEnd
Func _WM_COMMAND($hWnd, $iMsg, $iwParam, $ilParam)
Switch BitAND($iwParam, 0xFFFF)
Case $idEdit
Switch BitShift($iwParam, 16)
Case $EN_CHANGE
Local $i_Count = GUICtrlSendMsg($idEdit, $EM_GETLINECOUNT, 0, 0)
Select
Case $i_Count > $iCountLines
$iCountLines = $i_Count
GUICtrlSendToDummy($idDummy)
Case $i_Count < $iCountLines
$iCountLines = $i_Count
EndSelect
EndSwitch
EndSwitch
Return $GUI_RUNDEFMSG
EndFunc ;==>_WM_COMMAND