0

How can I check if the user is not using a computer for upto 5 minutes if he is not using a computer for 5 minute then perform a task or display something. Let say you were using a computer then you stop for maybe 5 minutes then the system will then display something just like the screen saver which is displayed after sometime a user is not using a computer, but i just want the instruction in vb.net. only how to check the user performance that all. thanks

2
Contributors
1
Reply
7
Views
4 Years
Discussion Span
Last Post by Begginnerdev
0

Are you wanting to listen for events while the application has focus, or when the application is running and focus isn't required?

If the first, then you just need to implement a timer/event lister on your form and place something like this in the timer.Tick event:

 Private iSecondsElasped As Integer = 0
 Private Sub Timer_Tick(sender As Object, e As EventArgs) Handles tmrInactive.Tick
    Try
        If iSecondsElasped = 300000 Then '5 minutes
            Application.SetSuspendState(PowerState.Suspend, True, False)
        Else
            iSecondsElasped += 1
        End If
    Catch ex As Exception
        MsgBox(ex.ToString)
    End Try
End Sub

If the application does not have focus, and you are wanting to listen for any actions (Mouse movement/keyboard input) - you will have to use hooks.

Edited by Begginnerdev

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.