#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
Opt("WinTitleMatchMode", 2)
Opt("GUIOnEventMode", 1)
Opt("TrayIconHide", 1)
#Region ### START Koda GUI section ### Form=
$mm_Form1 = GUICreate("防泄密", 170, 213, -1, -1)
GUISetOnEvent($GUI_EVENT_CLOSE, "mm_Form1Close")
$Label1 = GUICtrlCreateLabel("请输入密码:", 8, 8, 66, 17)
$Label2 = GUICtrlCreateLabel("刷新键盘", 88, 8, 60, 17)
GUICtrlSetFont(-1, 8, 400, 4, "MS Sans Serif")
GUICtrlSetColor(-1, 0x0000FF)
GUICtrlSetOnEvent(-1, "OutRandom")
$PasswordEdit = GUICtrlCreateInput("12345678", 9, 29, 153, 21, BitOR($GUI_SS_DEFAULT_INPUT, $ES_PASSWORD))
$Number1 = GUICtrlCreateButton("1", 8, 58, 36, 36)
GUICtrlSetOnEvent(-1, "main")
$Number2 = GUICtrlCreateButton("2", 48, 58, 36, 36)
GUICtrlSetOnEvent(-1, "main")
$Number3 = GUICtrlCreateButton("3", 88, 58, 36, 36)
GUICtrlSetOnEvent(-1, "main")
$Number4 = GUICtrlCreateButton("4", 8, 96, 36, 36)
GUICtrlSetOnEvent(-1, "main")
$Number5 = GUICtrlCreateButton("5", 48, 96, 36, 36)
GUICtrlSetOnEvent(-1, "main")
$Number6 = GUICtrlCreateButton("6", 88, 96, 36, 36)
GUICtrlSetOnEvent(-1, "main")
$Number7 = GUICtrlCreateButton("7", 8, 134, 36, 36)
GUICtrlSetOnEvent(-1, "main")
$Number8 = GUICtrlCreateButton("8", 48, 134, 36, 36)
GUICtrlSetOnEvent(-1, "main")
$Number9 = GUICtrlCreateButton("9", 88, 134, 36, 36)
GUICtrlSetOnEvent(-1, "main")
$Number0 = GUICtrlCreateButton("0", 8, 172, 36, 36)
GUICtrlSetOnEvent(-1, "main")
$assuredOK1 = GUICtrlCreateButton("确定", 128, 58, 35, 113)
GUICtrlSetOnEvent(-1, "assuredOK1Click")
$clearout1 = GUICtrlCreateButton("清除", 48, 172, 57, 36)
GUICtrlSetOnEvent(-1, "clearout1Click")
$retrieve1 = GUICtrlCreateButton("更正", 107, 172, 56, 36)
GUICtrlSetOnEvent(-1, "retrieve1Click")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
Sleep(100)
WEnd
Func main()
GUICtrlSetData($PasswordEdit, GUICtrlRead($PasswordEdit) & GUICtrlRead(@GUI_CtrlId))
If StringLen(GUICtrlRead($PasswordEdit)) <= 9 Then GUICtrlSetData($PasswordEdit, StringLeft(GUICtrlRead($PasswordEdit), 8))
EndFunc ;==>main
Func assuredOK1Click()
MsgBox(0, "密码", GUICtrlRead($PasswordEdit))
EndFunc ;==>assuredOK1Click
Func Clearout1Click()
GUICtrlSetData($PasswordEdit, "")
EndFunc ;==>Clearout1Click
Func Retrieve1Click()
GUICtrlSetData($PasswordEdit, StringLeft(GUICtrlRead($PasswordEdit), StringLen(GUICtrlRead($PasswordEdit)) - 1))
EndFunc ;==>Retrieve1Click
Func OutRandom();产生随机数字,修改0-9按钮位置
EndFunc ;==>OutRandom
Func mm_Form1Close()
Exit
EndFunc ;==>mm_Form1Close
源代码和程序见下面。