TIMER.Open |
![]() ![]() |
handle = TIMER.Open() AS HANDLE
Open a timer. The return value is a handle to the timer. If failed, the return value is -1 (MB_INVALID_HANDLE)
Example:
$LIBRARY "MyBASIC2_ExtLib" $INCLUDE "MyBASIC2_ExtLib"
DIM hTimer AS HANDLE
' Open a Timer hTimer = TIMER.Open()
IF hTimer <> MB_INVALID_HANDLE THEN ' Start the Timer TIMER.Start( hTimer ) ' Short Delay of 1.23 seconds SLEEP 1.23 ' Stop Timer TIMER.Stop( hTimer ) ' Display result in Seconds and MilliSeconds PRINT FORMAT( "Elapsed: %1.2f s, %1.0f ms", TIMER.Elapsed( hTimer ), TIMER.Elapsed( hTimer, 1000 ) ), ' Close Timer TIMER.Close( hTimer ) ENDIF
END |