I've written a simple class as a DLL for implementing timer functionality simply and easily. You don't need a form, and it isn't limited to 65 seconds either...
If anyone want's a copy, email me at m dot milan at blueyonder dot co dot uk
[blue]Public Sub [/blue]TimerProc([blue]ByVal [/blue]hWnd [blue]As Long[/blue], [blue]ByVal [/blue]nIDEvent [blue]As Long[/blue], [blue]ByVal [/blue]uElapse [blue]As Long[/blue], [blue]ByVal [/blue]lpTimerFunc [blue]As Long[/blue])
[blue]With [/blue]Form1.Text1
.Text = .Text & "Fired" & Now & vbCrLf
[blue]End With
End Sub
[/blue][green]'Form
[/green][blue]Option Explicit
Private Sub [/blue]Form_Load()
[blue]Dim [/blue]a [blue]As Long
[/blue]a = SetTimer(Me.hWnd, 0, 1000, [blue]AddressOf [/blue]TimerProc)
Text1.Text = a
[blue]End Sub
Private Sub [/blue]Form_Unload(Cancel [blue]As Integer[/blue])
[green]'Kill our API-timer
[/green]KillTimer Me.hWnd, 0
[blue]End Sub
Very similar to the approach I have taken, but the dll is the result of a combination of a class file and a module. I suppose I could post both and leave you all to try and compile it yourselves, but I'm in the office at the moment, so I'll have to try and remember to do it tonight...
). It's got a lot of neat functions, doesn't need a form and is easy to use in a class, and it wont crash the VB IDE if you stop to debug something, like the API timer can.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.