Results 1 to 9 of 9

Thread: Timer

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2000
    Posts
    617

    Timer

    Hello!

    I would like to set a timer on my VB prog so that If no acivity in the last 10 mins to give a message that the app will be closed down and if within 3 mins the person does not respond, the END

    Has any 1 done this?

  2. #2
    Hyperactive Member
    Join Date
    Nov 2003
    Location
    In Front of my computer...
    Posts
    367
    *EDIT* neverminde here it is

    VB Code:
    1. Dim i As Integer
    2.  
    3. Private Sub Form_Load()
    4.  Timer1.Interval = 60000
    5.  i = 0
    6.  Timer1.Enabled = True
    7. End Sub
    8.  
    9. Private Sub Timer1_Timer()
    10.  i = i + 1
    11.  If i = 10 Then MsgBox "10 minutes have past!!!"
    12. End Sub

  3. #3
    PowerPoster RhinoBull's Avatar
    Join Date
    Mar 2004
    Location
    New Amsterdam
    Posts
    24,132
    What type of activity is that?

  4. #4
    Hyperactive Member
    Join Date
    Nov 2003
    Location
    In Front of my computer...
    Posts
    367
    see my edited post

  5. #5
    Frenzied Member
    Join Date
    May 2003
    Location
    So Cal
    Posts
    1,564
    You need to reset i everytime there is activity or it will close down in 10 minutes even if you are using it.

    So you have to determine what is considered activity.

  6. #6

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2000
    Posts
    617

    Thanks to all

    The minimum activity is moving the cursor...

  7. #7

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2000
    Posts
    617

    ...Thanks

    Ok... The problem is not so much the timer implementation but rather checking for the "No Activity" at all in the app within that period of time... The minimum activity being any movement of the cursor in the app

    Thanks

  8. #8
    PowerPoster RhinoBull's Avatar
    Join Date
    Mar 2004
    Location
    New Amsterdam
    Posts
    24,132
    Problem with "no activity", Lafor, is that someone might not even use the mouse at all as keyboard could be used to navigate. So, having said that, you may need to implement some flags Set/Reset logic not only when user moves mouse (GetCursorPos api can be utilzed) but for every input field (textbox, combo, listboxes, etc) on your form as well. And this may become very hairy.

  9. #9

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2000
    Posts
    617

    Thus my question

    Thanks a lot Rhino and all of you!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width