本帖最后由 liongodmien 于 2013-3-13 14:23 编辑
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <StaticConstants.au3>
Example1()
Func Example1()
Local $msg, $Button_1, $Button_2, $open, $answer, $T, $L, $R, $Flag
$GUI = GUICreate("Test", 650, 200, -1, -1)
GUISetFont(25)
GUICtrlCreateLabel("456789", 3, 5, 650, 30)
$open = GUICtrlCreateInput("1234", 100, 70, 300, 35)
GUISetFont(10)
$Button_1 = GUICtrlCreateButton("确定", 120, 115, 70, 40)
GUICtrlSetState(-1, $GUI_FOCUS)
$Button_2 = GUICtrlCreateButton("取消", 260, 115, 70, 40)
GUISetState()
GUISetState(@SW_SHOW)
$L = StringLen(GUICtrlRead($open))
$T = TimerInit()
While 1
$msg = GUIGetMsg()
If ($L <> StringLen(GUICtrlRead($open))) Then
$L = StringLen(GUICtrlRead($open))
$R = TimerInit()
$Flag = 0
WinSetTitle($GUI, "", "Test")
ElseIf (TimerDiff($T) > 3E4) Then
$msg = $Button_1
ElseIf (TimerDiff($R) > 1E4) Then
$T = TimerInit()
$R = TimerInit() + 9E9
$Flag = 1
ElseIf $Flag Then
WinSetTitle($GUI, "", "选择剩余" & Int((3E4 - TimerDiff($T)) / 1E3) & "秒")
Else
Switch $msg
Case $GUI_EVENT_CLOSE
Exit
Case $Button_2
MsgBox(0,0,"点了按钮2")
Exit
Case $Button_1
MsgBox(0,0,"点了按钮1")
ExitLoop
EndSwitch
EndIf
WEnd
GUIDelete()
EndFunc ;==>Example1
|