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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Timer API

Status
Not open for further replies.

Mattheww

Programmer
Jan 17, 2004
3
CL
I'm actually running an email checker program which uses the Timer API to check the mail every so often. The problem is that the mail gets checked more often then the interval on the timer and I can't figure out why - In a module I have declared:

Declare Function SetTimer Lib "user32" (ByVal hwnd As Long, ByVal nIDEvent As Long, ByVal uElapse As
Long, ByVal lpTimerFunc As Long) As Long
Declare Function KillTimer Lib "user32" (ByVal hwnd As Long, ByVal nIDEvent As Long) As Long
Global TimerID As Long

Public Sub RunProgram()
.......
TimerID = SetTimer(0, 0, Interval * 1000, AddressOf MyTimer)
......
End Sub

Public Sub MyTimer(hwnd As Long, msg As Long, idTimer As Long, dwTime As Long)
Form1.CheckMail
End Sub

The symptoms are that the program tries to check the mail while the first winsock connection still exists (i.e. too soon) and hence I get an error saying the protocol was in an incorrect state for sending.
Any ideas?
 
two thoughts:

1 have you tried using the ordinary vb timers?

2 there's a status thing on the winsock control isn't there? I usually check that before I do anything

Mike
michael.j.lacey@ntlworld.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top