|
-
Apr 6th, 2008, 04:34 AM
#1
Thread Starter
Lively Member
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?
-
Apr 6th, 2008, 05:02 AM
#2
Junior Member
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? 
-
Apr 6th, 2008, 05:04 AM
#3
Thread Starter
Lively Member
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??
-
Apr 6th, 2008, 06:31 AM
#4
-
Apr 6th, 2008, 01:30 PM
#5
Thread Starter
Lively Member
Re: user inactivity
Hmmmm....could you send me a sample???
-
Apr 6th, 2008, 02:33 PM
#6
-
Apr 6th, 2008, 05:25 PM
#7
Fanatic Member
Re: user inactivity
 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.
-
Apr 6th, 2008, 05:36 PM
#8
Re: user inactivity
But isn't that global? Sounds like the OP wants it only for their program.
-
Apr 6th, 2008, 05:43 PM
#9
Fanatic Member
-
Apr 7th, 2008, 01:11 AM
#10
Thread Starter
Lively Member
Re: user inactivity
I don't need it global....I just want it only for my application...
-
Apr 7th, 2008, 02:54 PM
#11
Thread Starter
Lively Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|