Code : Tout sélectionner
;/ Author: BackupUser tweaked by Droopy
OpenWindow(0,0,0,230,120,#PB_Window_SystemMenu|#PB_Window_ScreenCentered,"Timer with API")
CreateGadgetList(WindowID(0))
TextGadget(0,10,10,210,30,"")
TextGadget(1,10,45,210,30,"")
TextGadget(2,10,80,210,30,"Timer 1 and 2 Started",#PB_Text_Center)
;/ Starting Timers
SetTimer_(WindowID(),1,150,0) ; Timer #1 each 150 ms
SetTimer_(WindowID(),2,1000,0) ; Timer #2 each 1 second
SetTimer_(WindowID(),3,10000,0) ; Timer #3 each 10 seconds
Repeat
Event = WaitWindowEvent()
If Event=#WM_TIMER
Select EventwParam()
Case 1 ;/ Timer #1
SetGadgetText(0,GetGadgetText(0)+"-")
Beep_(400,10)
Case 2 ;/ Timer #2
SetGadgetText(1,GetGadgetText(1)+"###")
Beep_(800,10)
Case 3 ;/ Timer #3
SetGadgetText(2,"Timer 1 and 2 Stopped")
KillTimer_(WindowID(),1) ;/ Kill Timer #1
KillTimer_(WindowID(),2) ;/ Kill Timer #2
Beep_(1500,500)
EndSelect
EndIf
Until Event=#PB_EventCloseWindow