是呀,与原始设计有关呀,如果原程序像你这么设计,永远也别想输入多余三个字符。是不是?
既然人家可以用其他方法输入字符,就说明人家有判断标准,能输入但是方法没找到。
下面这个代码,你用键盘输入将永远失败:#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 485, 90, -1, -1)
$Input1 = GUICtrlCreateInput("", 40, 32, 417, 21)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
AdlibRegister("_check",10)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
EndSwitch
WEnd
Func _check()
If stringlen(GUICtrlRead($Input1))=1 Then
Global $T0=TimerInit ()
ElseIf stringlen(GUICtrlRead($Input1))=3 Then
Global $T1=TimerDiff($T0)
if $T1>30 Then
GUICtrlSetData($Input1,"")
EndIf
EndIf
EndFunc
而用下面这段代码就可以输入:WinWaitActive("Form1")
ControlSetText("Form1","","Edit1","111111111111")
下面这个类似于你的代码,是永远没法输入的:#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 485, 90, -1, -1)
$Input1 = GUICtrlCreateInput("", 40, 32, 417, 21)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
AdlibRegister("_check",10)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
EndSwitch
WEnd
Func _check()
If stringlen(GUICtrlRead($Input1))=>3 Then
GUICtrlSetData($Input1,"")
EndIf
EndFunc
|