Back to the principal form!

part
05-31-2005, 06:28 AM
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

part
06-01-2005, 04:13 AM
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!

part
06-03-2005, 05:52 AM
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!

part
06-05-2005, 07:25 AM
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!

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum