User inactivity and returning to main form vb.net

Discussion in 'Mixed Languages' started by kjsupe, Sep 30, 2012.

  1. kjsupe

    kjsupe MDL Novice

    Sep 30, 2012
    3
    0
    0
    Hopefully this is an easy problem for some of you code gurus out there. I am by no means an expert coder, far from it actually. I am writing a Kiosk interface for a rewards program at my work and I just need a simple snippet of code that will return to the main form after 30 seconds of no user activity. I would like to monitor globally and not just in my program. It is a touch screen system, so I don't need to detect keystrokes, only mouse movements. I have 5 different forms and if any of the 2-5 forms are open with no user input for more than 30 seconds, I would like to close them and return to form1. This is really the last piece I need to complete this project. Many thanks in advance!
     
  2. Josh Cell

    Josh Cell MDL Developer

    Jan 8, 2011
    3,515
    7,170
    120
    Maybe you can make an timer that stores every second the mouse pointer location and if is equals on a time period, closes the form and back to the main again.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. Muerto

    Muerto MDL Debugger

    Mar 7, 2012
    1,855
    2,103
    60
    #3 Muerto, Sep 30, 2012
    Last edited: Aug 22, 2021
    ...
     
  4. Muerto

    Muerto MDL Debugger

    Mar 7, 2012
    1,855
    2,103
    60
    #4 Muerto, Sep 30, 2012
    Last edited: Aug 22, 2021
    ...
     
  5. kjsupe

    kjsupe MDL Novice

    Sep 30, 2012
    3
    0
    0
    Thank a million, this worked great. The one issue I am seeing is that it will not work on one of my forms however. Its really no big deal as it works great on the others. The form it is not working on just has a text box that gets focus as soon as the form loads (so it has a blinking cursor). Not sure what all Wndproc looks for, but I can't figure out why it won't return from that screen. Any ideas?
     
  6. Michaela Joy

    Michaela Joy MDL Crazy Lady

    Jul 26, 2012
    4,071
    4,651
    150
    Not sure how you would do it in VB.net, but I would think that you have to subclass the edit controls' WndProc, look at its' messages and respond to the ones that you want to work with.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  7. Muerto

    Muerto MDL Debugger

    Mar 7, 2012
    1,855
    2,103
    60
    #7 Muerto, Oct 2, 2012
    Last edited: Aug 22, 2021
    ...