BabyFace
asked on
SetTimer
Hi,
When setting a Timer using the API func. SetTimer,
How can you make sure that the handle of the timer you're
providing isn't already in use?
Is there a function that returns the next valid timer handle?
Something like FreeFile???
Thanks in advance
When setting a Timer using the API func. SetTimer,
How can you make sure that the handle of the timer you're
providing isn't already in use?
Is there a function that returns the next valid timer handle?
Something like FreeFile???
Thanks in advance
whoops,
If the return value is zero, the function failed.
If the return value is zero, the function failed.
ASKER
Hi,
Perhapse I should make my question a little clearer.
Sorry.
This is the definition of SetTimer:
Declare Function SetTimer Lib "user32" Alias "SetTimer" (ByVal hWnd As Long, ByVal nIDEvent As Long, ByVal uElapse As Long, ByVal lpTimerFunc As Long) As Long
How do I find the next valid timer identifier?
because what if you did this?
SetTimer me.hwnd,1,1000,addressof Myfunc
[in another function]
SetTimer me.hwnd,1,1000,addressof MyFunc2
[destory event]
KillTimer 1
???? What about the other timer?????
Perhapse I should make my question a little clearer.
Sorry.
This is the definition of SetTimer:
Declare Function SetTimer Lib "user32" Alias "SetTimer" (ByVal hWnd As Long, ByVal nIDEvent As Long, ByVal uElapse As Long, ByVal lpTimerFunc As Long) As Long
How do I find the next valid timer identifier?
because what if you did this?
SetTimer me.hwnd,1,1000,addressof Myfunc
[in another function]
SetTimer me.hwnd,1,1000,addressof MyFunc2
[destory event]
KillTimer 1
???? What about the other timer?????
As I said, the timer function RETURNS a long integer identifying the new timer. It is unique. When set the timer like this:
TimerID = SetTimer me.hwnd,1,1000,addressof Myfunc
And release it:
Kill TimerID
The second argument in you're example (1) is the EVENT ID
TimerID = SetTimer me.hwnd,1,1000,addressof Myfunc
And release it:
Kill TimerID
The second argument in you're example (1) is the EVENT ID
ASKER
Quote:
TimerID = SetTimer me.hwnd,1,1000,addressof Myfunc
And release it:
Kill TimerID
I suppose you ment KillTimer TimerID right?
But the description of the KillTimer say that it receives a windows hwnd and the timer identifier
not the timer handle.
So how do you find the next valid timer handle.?
TimerID = SetTimer me.hwnd,1,1000,addressof Myfunc
And release it:
Kill TimerID
I suppose you ment KillTimer TimerID right?
But the description of the KillTimer say that it receives a windows hwnd and the timer identifier
not the timer handle.
So how do you find the next valid timer handle.?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
There is a Timer control with VB - it's easier to use.