|
发表于 2010-10-23 12:18:55
|
显示全部楼层
本帖最后由 njuFerret 于 2010-10-23 12:21 编辑
给你一个完整例子:
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Include <Timers.au3>
Opt("GUIOnEventMode", 1)
#Region ### START Koda GUI section ### Form=
$hGUI = GUICreate("Form1", 244, 25)
GUISetOnEvent($GUI_EVENT_CLOSE, "Form1Close")
GUISetOnEvent($GUI_EVENT_MINIMIZE, "Form1Minimize")
GUISetOnEvent($GUI_EVENT_MAXIMIZE, "Form1Maximize")
GUISetOnEvent($GUI_EVENT_RESTORE, "Form1Restore")
$Input1 = GUICtrlCreateInput("Input1", 64, 0, 153, 21)
GUICtrlSetOnEvent(-1, "Input1Change")
$Label1 = GUICtrlCreateLabel("当前时间:", 0, 3, 64, 17)
GUICtrlSetOnEvent(-1, "Label1Click")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
_Timer_SetTimer($hGUI, 1000, "_UpdateClock") ; create timer
GUICtrlSetData($Input1, StringFormat("%02d:%02d:%02d", @HOUR, @MIN, @SEC), 2)
While 1
Sleep(100)
WEnd
Func Form1Close()
Exit
EndFunc ;==>Form1Close
Func Form1Maximize()
EndFunc ;==>Form1Maximize
Func Form1Minimize()
EndFunc ;==>Form1Minimize
Func Form1Restore()
EndFunc ;==>Form1Restore
Func Input1Change()
EndFunc ;==>Input1Change
Func Label1Click()
EndFunc ;==>Label1Click
; call back function
Func _UpdateClock($hWnd, $Msg, $iIDTimer, $dwTime)
#forceref $hWnd, $Msg, $iIDTimer, $dwTime
GUICtrlSetData($Input1, StringFormat("%02d:%02d:%02d", @HOUR, @MIN, @SEC))
EndFunc ;==>_UpdateClock |
评分
-
查看全部评分
|