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

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.