回复 1# liupeng1990607
要实现类似"自动", 最好是注册系统信息吧. 参考一下别的帖子就有了.
#include <WindowsConstants.au3>
#include <GuiConstants.au3>
#include <EditConstants.au3>
#include <Array.au3>
Opt('MustDeclareVars', 1)
Global $hGui, $msg, $Input1, $Input2
Global $XueHao[3] = [111, 112, 113]
Global $XingMing[3] = ["Adam", "John", "Jack"]
$hGui = GUICreate('Test', 450, 200)
$Input1 = GUICtrlCreateInput("", 10, 10, 400, 30)
$Input2 = GUICtrlCreateInput("", 10, 80, 400, 30)
GUICtrlSetState(-1, $GUI_DISABLE)
GUIRegisterMsg($WM_COMMAND, "MY_WM_COMMAND")
GUISetState()
While True
$msg = GUIGetMsg()
If $msg = $GUI_EVENT_CLOSE Then Exit
WEnd
Func MY_WM_COMMAND($hWnd, $msg, $wParam, $lParam)
Local $nNotifyCode = BitShift($wParam, 16)
Local $nID = BitAND($wParam, 0x0000FFFF)
If $nNotifyCode = $EN_KILLFOCUS Or $nNotifyCode = $EN_CHANGE Then
Local $index = _ArraySearch($XueHao, GUICtrlRead($Input1))
If @error Then
GUICtrlSetData($Input2, '无此学号')
Else
GUICtrlSetData($Input2, $XingMing[$index])
EndIf
EndIf
EndFunc ;==>MY_WM_COMMAND
|