For Keyboard and MouseDown:
Code:
Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer
Private Const ELAPSE = 5 ' Number of minutes before elapsation
Private Sub Form_Load()
Timer1.Interval = 100
End Sub
Private Sub Timer1_Timer()
Static Keyless As Long
Dim Ctr As Integer
For i = 0 To 255
If GetAsyncKeyState(i) And &H8000 Then
'A key has been pressed
Ctr = 0
Else: Ctr = Ctr + 1
End If
Next:
If Ctr = 256 Then
'No Keys Have been pressed
Keyless = Keyless + 1
If Keyless = (10 * 60 * ELAPSE) Then
'No keys have been pressed for 5 minutes
End If
Else:
Keyless = 0
End If
End Sub
Phew! I've been doing VB for a couple of years and that was quite hard. I would aim for something a little, well, actually a lot less ambitious. Unless, of course, you are a genius who learnt Portugese in under two hours and can predict lightening, in which case feel free to learn C++.