I have a problem with my timer
all a sudden not working.
It wont run through the code
and it is still enabled, I
changed.
Why??
Printable View
I have a problem with my timer
all a sudden not working.
It wont run through the code
and it is still enabled, I
changed.
Why??
May be you can post your code and let us have look on what you did? :)
impossable.
11 timers, 20 forms.. 20 modules..
its a 12 meg program.
Why you need so many Timer? Most properly, I think is before others Timer is executing some dedicated code under it Timerx_Timer() events.
If you really need so many Timer in your program, Then you may need to revise all your Timer interval. Try to have a proper time slot for each Timer. Make sure they don't overlapp each others.
But the best still try to remove some Timer.
You shouldn't use so many timers. I once read somewhere that windows can only take a limited amount of timers but I forgot why and how many.
You can do with 1 per project and derive different intervals from this one.
All the code can be in one timer event then.
[Edited by LAURENS on 06-16-2000 at 10:38 AM]
What's your program supposed to do?
Osborn
Its a 3d game.
I cant get around the
timers.
What else could I use like a timer?
Use the GetTickCount API.
Make sure that the timer's value isn't set to 0 because if it is, it woun't work
If your game does not require a high accuratecy timer, then may be you can use the SetTimer and KiiTimer as shown below:
Code:'Code under Basic Module
Option Explicit
Private Declare Function SetTimer Lib "user32" (ByVal hwnd As Long, ByVal nIDEvent As Long, ByVal uElapse As Long, ByVal lpTimerFunc As Long) As Long
Private Declare Function KillTimer Lib "user32" (ByVal hwnd As Long, ByVal nIDEvent As Long) As Long
Public Sub load_SetTimer(ByVal MyhWnd As Long, ByVal MyInterval As Long)
SetTimer MyhWnd, 0, MyInterval, AddressOf TimerProc
End Sub
Sub TimerProc(ByVal hwnd As Long, ByVal nIDEvent As Long, ByVal uElapse As Long, ByVal lpTimerFunc As Long)
Do what ever your game needed here.
End Sub
Public Sub load_KillTimer()
KillTimer frmMain.hwnd, 0
End Sub
'Code under Form Assume your form is named frmMain.frm
Private Sub Form_Load()
'Timer with interval 60Seconds
load_SetTimer Me.hWnd, 60000
End Sub
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
'Reset the Timer upon exit the games
load_KillTimer
End Sub
[Edited by Chris on 06-17-2000 at 03:13 PM]