Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SetTimer

Status
Not open for further replies.

ASPVBNerd

Programmer
Joined
Nov 23, 2005
Messages
83
Location
SE
I am using a Timer.
If I use a timer then max interval 65,535 milliseconds seconds.

What is the max Intervall if I use the Api funcion SetTimer
I would like to enable an interval at every 10 minutes.

Is this possible with SetTimer?
 
It's possible with the VB Timer, you know. Let's see ... 60000 milliseconds is 1 minute. So, if we set the Timer's interval for 1 minute, and do it 10 times. e.g.:
Code:
[blue]Private Sub Timer1_Timer()
    Static TimerCounter As Long
    TimerCounter = TimerCounter + 1
    If TimerCounter Mod 10 = 0 Then
        [green]' Do Timer stuff, since this is 10 minutes[/green]
    End If
End Sub[/blue]

 
Thanx strongm for the solution.

Another solution is this.
Code:
Public Declare Function SetTimer Lib "user32" (ByVal hwnd As Long, ByVal nIDEvent As Long, ByVal uElapse As Long, ByVal lpTimerFunc As Long) As Long

Public Function ServiceTime()
    lngTimerID = SetTimer(0, 0, 600000, AddressOf TimerProc)

End Function
Private Function TimerProc(ByVal hwnd As Long, _
           ByVal uMsg As Long, _
           ByVal idEvent As Long, _
           ByVal dwTime As Long)
           
End Function
 
You probably want a KillTimer in there as well
 
Why would I want a KillTimer?
Could you explaing that to me?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top