Any better/more acurate way to keep track of time in VB than a timer control? It'd be nice to be able to track time intervals less than a second with some degree of accuracy.
Eiredrake
Printable View
Any better/more acurate way to keep track of time in VB than a timer control? It'd be nice to be able to track time intervals less than a second with some degree of accuracy.
Eiredrake
Use the QueryPerformanceCounter API. I think it's accurate up to 1 microsecond (1 millionth of a second).
If you don't need that accurate, you can also use TWO timers. It still aren't so fast it should be, but much faster than with only one.
This works atleast with VB4 (I've used the trick in my slot machine game named Merrysoft Jackpot).
Or just use GetTickCount which is most common because it is accurate up to 1ms.
Gettickcount api solves most problems it's accurate to 1ms and with iterating loops with doevents you make your timers executing with different intervals
Heres an example at:
http://forums.vb-world.net/showthrea...threadid=18669
Also, here's some results using different timers:
http://forums.vb-world.net/showthrea...threadid=18440