|
-
Nov 26th, 2000, 06:56 PM
#1
Thread Starter
Hyperactive Member
What is the procedure for creating and using timers?
I don't want to use the control. I want to do it all by using the api.
Which way is more efficient on resources and the like?
BW
-
Nov 26th, 2000, 09:09 PM
#2
The SetTimer api function may be what your looking for .
-
Nov 26th, 2000, 09:13 PM
#3
Thread Starter
Hyperactive Member
Thanks a lot!!
Thats exactly what i was after.
Cheers for that. All go now.
BW
-
Nov 27th, 2000, 03:34 PM
#4
I find that example too complex. Here is a more simple one.
Code for a Module
Code:
Declare Function SetTimer Lib "user32.dll" (ByVal hWnd As Long, ByVal nIDEvent As Long, ByVal uElapse As Long, ByVal lpTimerFunc As Long) As Long
Declare Function KillTimer Lib "user32.dll" (ByVal hWnd As Long, ByVal nIDEvent As Long)
Public Sub TimerProc(ByVal hWnd As Long, ByVal uMsg As Long, ByVal idEvent As Long, ByVal dwTime As Long)
MsgBox "Timer message"
End Sub
Public Sub StartTimer(ByVal lInterval)
SetTimer Form1.hWnd, 1000, lInterval, AddressOf TimerProc
End Sub
Public Sub StopTimer()
KillTimer Form1.hWnd, 1000
End Sub
Code for a Form.
Code:
Private Sub Form_Load()
StartTimer 1000
End Sub
Private Sub Form_Unload(Cancel As Integer)
StopTimer
End Sub
-
Nov 27th, 2000, 03:42 PM
#5
Thread Starter
Hyperactive Member
Cheers Megatron
Thats pretty much what i got the other example down to.. Cept for some user definable variables for the time length.
Is it any more efficient to use the API over the timer control? Personally i like to use API over controls, then i know whats going on, well sorta. hehehe
BW
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
|