|
-
Jun 15th, 2000, 01:22 PM
#1
Thread Starter
Addicted Member
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??
-
Jun 15th, 2000, 01:28 PM
#2
-
Jun 15th, 2000, 01:31 PM
#3
Thread Starter
Addicted Member
impossable.
11 timers, 20 forms.. 20 modules..
its a 12 meg program.
-
Jun 15th, 2000, 01:37 PM
#4
PowerPoster
Too Many Timer
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.
-
Jun 15th, 2000, 02:17 PM
#5
Addicted Member
One timer is enough
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]
Regards,
Laurens
Using VB5 Enterprise edition SP3
VB6 Enterprise edition SP5
-
Jun 15th, 2000, 03:37 PM
#6
New Member
program
What's your program supposed to do?
Osborn
-
Jun 15th, 2000, 04:00 PM
#7
Thread Starter
Addicted Member
Its a 3d game.
I cant get around the
timers.
What else could I use like a timer?
-
Jun 16th, 2000, 03:30 AM
#8
Use the GetTickCount API.
-
Jun 17th, 2000, 01:35 AM
#9
Frenzied Member
Make sure that the timer's value isn't set to 0 because if it is, it woun't work
-
Jun 17th, 2000, 01:58 AM
#10
PowerPoster
SetTimer + KillTimer
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]
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
|