#include <WindowsConstants.au3>
Global $LastInputID
$Form1 = GUICreate("Form1", 615, 437, 192, 124)
$Input1 = GUICtrlCreateInput("", 152, 32, 97, 21)
$Input2 = GUICtrlCreateInput("", 152, 68, 97, 21)
$Input3 = GUICtrlCreateInput("", 152, 105, 97, 21)
$Input4 = GUICtrlCreateInput("", 152, 141, 97, 21)
$Input5 = GUICtrlCreateInput("", 375, 40, 97, 21)
$Input6 = GUICtrlCreateInput("", 375, 76, 97, 21)
$Input7 = GUICtrlCreateInput("", 375, 113, 97, 21)
$Input8 = GUICtrlCreateInput("", 375, 149, 97, 21)
$Button1 = GUICtrlCreateButton("1", 152, 192, 49, 33)
$Button2 = GUICtrlCreateButton("2", 206, 192, 49, 33)
$Button3 = GUICtrlCreateButton("3", 260, 192, 49, 33)
$Button4 = GUICtrlCreateButton("4", 315, 192, 49, 33)
$Button5 = GUICtrlCreateButton("5", 369, 192, 49, 33)
$Button6 = GUICtrlCreateButton("退格", 423, 192, 49, 33)
$Button7 = GUICtrlCreateButton("6", 152, 245, 49, 33)
$Button8 = GUICtrlCreateButton("7", 206, 245, 49, 33)
$Button9 = GUICtrlCreateButton("8", 260, 245, 49, 33)
$Button10 = GUICtrlCreateButton("9", 315, 245, 49, 33)
$Button11 = GUICtrlCreateButton("0", 369, 245, 49, 33)
$Button12 = GUICtrlCreateButton("清除", 423, 245, 49, 33)
GUISetState(@SW_SHOW)
GUIRegisterMsg($WM_COMMAND, 'WM_COMMAND')
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case -3
Exit
Case $Button1 To $Button5, $Button7 To $Button11
If $LastInputID > 0 Then GUICtrlSetData($LastInputID, GUICtrlRead($LastInputID) & GUICtrlRead($nMsg))
Case $Button6
If $LastInputID > 0 Then GUICtrlSetData($LastInputID, StringTrimRight(GUICtrlRead($LastInputID), 1))
Case $Button12
If $LastInputID > 0 Then GUICtrlSetData($LastInputID, "")
EndSwitch
WEnd
;全局按钮
Func WM_COMMAND($hWnd, $msg, $wParam, $lParam)
Local $nID = BitAND($wParam, 0x0000FFFF)
Switch $nID
Case $Input1 To $Input8
$LastInputID = $nID
EndSwitch
EndFunc ;==>WM_COMMAND