|
-
Feb 17th, 2000, 03:25 AM
#1
Thread Starter
New Member
I have made a simple timer using interval=100 etc
but it seems to work at differnt speeds on faster or slower computers.
Is it possible to get vb to copy the windows clock.
Or is there another way.
Thanx a lot Michael Baynham
-
Feb 17th, 2000, 05:05 AM
#2
PowerPoster
You can use GetTickCount from the API.
-
'In module
Public Declare Function GetTickCount Lib "kernel32" Alias "GetTickCount" () As Long
'The 'Timer'
Dim Temp as Long
Dim Interval as Long
Dim Enabled as Boolean
Interval = 100
Enabled = true
While Enabled
If Temp + Interval < GetTickCount Then
Temp = GetTickCount
'Code here
Endif
DoEvents
Wend
-
------------------
[email protected]
...
Every program can be reduced to one instruction which doesn't work.
-
Feb 17th, 2000, 05:37 AM
#3
Hyperactive Member
I would say that timers interval is not dependant on a computer speed. But if time needed to execute codes inside timer (wich ir related to copmuter speed) become longer then timer's interval, then APP starts skipping Timer events. That especialy noticible if drawing is involved.
I ussualy messure codes execution time inside Timer events and if it comes longer the Timer Interval I make the adjustment to Interval.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|