Hi!
I try but i can't do it. After some minutes in a form without any mouse move going back to the principal form.
Anyone can help me?
Thanks a lot!
Flyguy
05-31-2005, 06:52 AM
Have a timer control on the child form.
Define some time frame.
Reset the counter in the mousemove event of the form.
In the timer event check the counter.
Option Explicit
Private m_lStartTime As Long
Private Sub Form_Load()
' intialize counter offset
m_lStartTime = Timer
End Sub
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
' re-intialize counter offset
m_lStartTime = Timer
End Sub
Private Sub Timer1_Timer()
Dim lEndTime As Long
lEndTime = Timer
If lEndTime - m_lStartTime > 5 Then
' more then 5 secs of inactivity
Unload Me
Else
' show time left
Me.Caption = 5 - Int(lEndTime - m_lStartTime)
End If
End Sub
Hi!
I try the code below and i understand that! But it still don't work 100%. See the problem:
1º - I have a from1 link to form2 link to form3, etc.
2º - Each form have a background picture and a label
3º - The goal is if no mouse move in form2 or form3...etc going back to form1
4º - The code works great if the mouse pointer is over the label. If there is over the form, it dosen't works!
I try to re-initialize the timer in the label, i try to delete the label,... but nothing! Where is the mistake?
Thanks a lot!
Hi!
I try many ways but i can't find a way... One thing i'm sure: the timer re-initialize on mouse move its iqual than the end time. So i can not reinitialize on mouse move!
Can anyone help me!
Thanks!
Hi!
Thanks to the Flyguy! The code works great! I finnaly found my error: i miss to unload the form before starts to show another one. I just unload the form behind and that's it!
THANKS A LOT!