#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
$Form1 = GUICreate("Form1", 629, 106, 192, 132)
$Input1 = GUICtrlCreateInput("Input1", 40, 32, 433, 24)
$Button1 = GUICtrlCreateButton("Button1", 496, 32, 105, 33)
GUISetState(@SW_SHOW)
GUIRegisterMsg($WM_COMMAND, "MY_WM_COMMAND")
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
mem(GUICtrlRead($Input1))
GUICtrlSetData($Input1,'')
EndSwitch
WEnd
Func mem($string)
msgbox(0,0,$string)
EndFunc
Func MY_WM_COMMAND($hWnd, $msg, $wParam, $lParam)
Local Const $EN_CHANGE = 0x300
Local $nNotifyCode = BitShift($wParam, 16)
Local $nID = BitAND($wParam, 0xFFFF)
Local $hCtrl = $lParam
if $nID =$Input1 Then
If $nNotifyCode = $EN_CHANGE Then
If StringLen(GUICtrlRead($Input1)) >=4 Then
mem(GUICtrlRead($Input1))
GUICtrlSetData($Input1,'')
;GUICtrlSetData($Input1,StringLeft(GUICtrlRead($Input1),4))
EndIf
EndIf
EndIf
EndFunc ;==>MY_WM_COMMAND
|