;请参考AutoIt帮助文件之GUIRegisterMsg 、_WinAPI_SetTimer 、_WinAPI_KillTimer 、
;_Date_Time_GetLocalTime、_Date_Time_SystemTimeToTimeStr
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <Date.au3>
#Include <WinAPIEx.au3>
Global $hEdit
Example()
Func Example()
Local Const $BS_OWNERDRAW = 0x0000000B
Local $hGUI, $GUIMsg
$hGUI = GUICreate("My Ownerdrawn Created Button", 300, 200)
$hEdit = GUICtrlCreateEdit("First line" & @CRLF, 10, 10, 200, 100, $ES_AUTOVSCROLL + $WS_VSCROLL)
GUIRegisterMsg($WM_TIMER, "MY_TIMERPROC")
GUISetState()
_WinAPI_SetTimer ($hGUI, 0, 1000, 0)
While 1
$GUIMsg = GUIGetMsg()
Switch $GUIMsg
Case $GUI_EVENT_CLOSE
ExitLoop
EndSwitch
WEnd
_WinAPI_KillTimer($hGUI, 0)
EndFunc ;==>Example
Func MY_TIMERPROC($hWnd, $Msg, $wParam, $lParam)
$tNew = _Date_Time_EncodeSystemTime(8, 19, @YEAR, 3, 10, 45)
$tNew = _Date_Time_GetLocalTime()
$str = _Date_Time_SystemTimeToTimeStr($tNew)
GUICtrlSetData($hEdit, $str)
EndFunc
附上 WinAPIEx.au3
|