Results 1 to 11 of 11

Thread: user inactivity

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Mar 2007
    Posts
    82

    user inactivity

    Hello everyone

    I have a large VB6 application (I am using something about 150 forms) and I want to do something like this......

    after one time of user inactivity (regarding this aplication) to do something...


    is there any other way then calling a timer on every event?

  2. #2
    Junior Member
    Join Date
    Apr 2008
    Posts
    30

    Re: user inactivity

    Wouldent you be able to define one such timer in a global function and then do it that way?
    Is your name George?

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Mar 2007
    Posts
    82

    Re: user inactivity

    I don't understant your answer.....

    Yes, I could create a global function but I should call it on every event....
    isn't that true??

  4. #4
    Super Moderator manavo11's Avatar
    Join Date
    Nov 2002
    Location
    Around the corner from si_the_geek
    Posts
    7,171

    Re: user inactivity

    Maybe you could try subclassing every form and check for a click or keypress message to be sent (don't remember if clicks on a control are sent as messages to the form). If that's possible, it would be simpler than to add code to every event.


    Has someone helped you? Then you can Rate their helpful post.

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Mar 2007
    Posts
    82

    Re: user inactivity

    Hmmmm....could you send me a sample???

  6. #6
    Super Moderator manavo11's Avatar
    Join Date
    Nov 2002
    Location
    Around the corner from si_the_geek
    Posts
    7,171

    Re: user inactivity

    I don't have VB6 installed here, so I can't help you any further at the moment. Look into subclassing for a start, then try and see what the specific messages are that you need to capture.

    If this seems to hard, it might not be worth the time and effort to make it work, it's your call


    Has someone helped you? Then you can Rate their helpful post.

  7. #7
    Fanatic Member Dungeon Keeper's Avatar
    Join Date
    Mar 2008
    Posts
    590

    Re: user inactivity

    Quote Originally Posted by corneagigi
    Hello everyone

    I have a large VB6 application (I am using something about 150 forms) and I want to do something like this......

    after one time of user inactivity (regarding this aplication) to do something...


    is there any other way then calling a timer on every event?
    I have an example for you. Add a timer and a label to your form and paste this code:

    Code:
    Option Explicit
    
    Private Type LASTINPUTINFO
       cbSize As Long
       dwTime As Long
    End Type
    
    Dim lii As LASTINPUTINFO
    
    'Private Declare Function GetTickCount Lib "kernel32" () As Long
    
    Private Declare Function GetLastInputInfo Lib "user32" (plii As Any) As Long
    
    Dim check As Long
    
    
    Private Sub Form_Load()
    
       Timer1.Interval = 60000
       Timer1.Enabled = True
           
    End Sub
    
    
    
    
    Private Sub Form_Unload(Cancel As Integer)
    
       Timer1.Enabled = False
       
    End Sub
    
    
    Private Sub Timer1_Timer()
    
       lii.cbSize = Len(lii)
       Call GetLastInputInfo(lii)
       
       Label1.Caption = lii.dwTime
       If check = lii.dwTime Then
           MsgBox ("Screen Saver")
       Else: 
           check = lii.dwTime
       End If
             
    End Sub

    This example shows the time when an input happens. So you can check this time for your last input every 5 minutes. If the time is similar to last time, tere was no input for that period .

    I hope you understand me

    Edit: I have made some changes in code above. Program now checks every minute for input. If there was no input msgbox "Screen Saver" appears
    Last edited by Dungeon Keeper; Apr 6th, 2008 at 05:34 PM.

  8. #8
    VB For Fun Edgemeal's Avatar
    Join Date
    Sep 2006
    Location
    WindowFromPoint
    Posts
    4,255

    Re: user inactivity

    But isn't that global? Sounds like the OP wants it only for their program.

  9. #9
    Fanatic Member Dungeon Keeper's Avatar
    Join Date
    Mar 2008
    Posts
    590

    Re: user inactivity

    Yes it is global.

  10. #10

    Thread Starter
    Lively Member
    Join Date
    Mar 2007
    Posts
    82

    Re: user inactivity

    I don't need it global....I just want it only for my application...

  11. #11

    Thread Starter
    Lively Member
    Join Date
    Mar 2007
    Posts
    82

    Re: user inactivity

    So, can anyone help me????

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