Click to See Complete Forum and Search --> : How to create and use a timer with API calls?
But_Why
Nov 26th, 2000, 05:56 PM
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 :cool:
The SetTimer (http://www.vbapi.com/ref/s/settimer.html) api function may be what your looking for :rolleyes:.
But_Why
Nov 26th, 2000, 08:13 PM
Thats exactly what i was after.
Cheers for that. All go now.
BW :cool:
I find that example too complex. Here is a more simple one.
Code for a Module
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.
Private Sub Form_Load()
StartTimer 1000
End Sub
Private Sub Form_Unload(Cancel As Integer)
StopTimer
End Sub
But_Why
Nov 27th, 2000, 02:42 PM
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 :cool:
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.