hi, my professor ask us to create a program that has auto logout feature after 2mins or set my own time to logout, after the user logged in to the machine, if ever he or she left it without pressing the logout after 2 mins of being idle or standby it will return to the login screen. Help me please ! im using vb6

Recommended Answers

All 4 Replies

You need to capture keyboard and mouse events and use Timer.
Reset the timer on each user interaction (keyboard and mouse events).

how can i capture a keyboard or mouse event ?

my professor ask us to create a program that has auto logout feature after 2mins or set my own time to logout, after the user logged in to the machine,

just add one timer and set interval to 1000 and then write the following code :-

Private Sub Timer1_Timer()
Static i As Integer
If i = 120 Then Unload UserForm : Login.Show: Exit Sub
i = i + 1
End Sub

hope this helps you.

what do you mean by declaring a static sir ?

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.