| |
|
|
| iF, Beitrag=54521, Zeitpunkt=19.10.2009
Fix hingepinselt KompilierenMarkierenSeparieren {$cleq}
decimals 0
cls
longs timer,hDisp,hStart,hPause,hReset
whileLoop 20
timer[loop]=0
hDisp[loop]=createText(hWnd,"Timer:"+str$(loop),20,loop*20,400,18)
hStart[loop]=createButton(hWnd,"Start",450,loop*20,50,18)
hPause[loop]=createButton(hWnd,"Pause",500,loop*20,50,18)
hReset[loop]=createButton(hWnd,"Reset",550,loop*20,50,18)
wend
subClass hWnd,true
~setTimer(hWnd,222,100,0)
while 1
waitinput
whileLoop 20
case clicked(hStart[loop]) : timer[loop]=getTickCount
case clicked(hPause[loop]) : timer[loop]=-timer[loop]
if clicked(hReset[loop])
timer[loop]=0
setText hDisp[loop],"0"
endif
wend
wend
end
subClassProc
if sMessage==wm_timer
if sWParam==222
whileLoop 20
if timer[loop]>0
setText hDisp[loop],str$(getTickCount-timer[loop])+"ms"
endif
wend
endif
endif
endproc
KompilierenMarkierenSeparieren $H windows.ph
DECIMALS 0
CLS
DECLARE TIMER&[]
DECLARE HDISP&[]
DECLARE HSTART&[]
DECLARE HPAUSE&[]
DECLARE HRESET&[]
WHILELOOP 20
TIMER&[&LOOP]=0
HDISP&[&LOOP]=(CONTROL("STATIC","Timer:"+STR$(&LOOP),$50000000,(20),(&LOOP*20),(400),(18),(%HWND),0,%HINSTANCE))
HSTART&[&LOOP]=(CREATE("BUTTON",(%HWND),"Start",(450),(&LOOP*20),(50),(18)))
HPAUSE&[&LOOP]=(CREATE("BUTTON",(%HWND),"Pause",(500),(&LOOP*20),(50),(18)))
HRESET&[&LOOP]=(CREATE("BUTTON",(%HWND),"Reset",(550),(&LOOP*20),(50),(18)))
ENDWHILE
SUBCLASS %HWND,1
~setTimer(%HWND,222,100,0)
WHILE 1
WAITINPUT
WHILELOOP 20
IF CLICKED(HSTART&[&LOOP])
TIMER&[&LOOP]=&GETTICKCOUNT
ENDIF
IF CLICKED(HPAUSE&[&LOOP])
TIMER&[&LOOP]=-TIMER&[&LOOP]
ENDIF
IF CLICKED(HRESET&[&LOOP])
TIMER&[&LOOP]=0
SETTEXT HDISP&[&LOOP],"0"
ENDIF
ENDWHILE
ENDWHILE
end
subclassproc
IF %SMESSAGE=$0113
IF &SWPARAM=222
WHILELOOP 20
IF TIMER&[&LOOP]>0
SETTEXT HDISP&[&LOOP],STR$(&GETTICKCOUNT-TIMER&[&LOOP])+"ms"
ENDIF
ENDWHILE
ENDIF
ENDIF
endproc
ohne Feinschliff. Auch lustig [...] aus [...] . |
|
|
| |
|
|