No, that's not right.
What you need to do is to trap the MouuseMove
event. Every object has this event. To determine if the user moves the mouse, you would need to write code in the MouseMove event of every control in your application. If you have a proper class hierarchy in place, it's much easier: you would only need to write the code in the MouseMove event of each of your root classes, that is, the root classes for labels, textboxes, edit boxes, pageframes, grids, .... in fact, every control that can be placed on a form (plus that of the form itself).
In every case, the code would record the time that the even fires. For simplicity, let's assume you use a public variable for this. Then, in the timer (see Dan's post, above), you would compare that time with the current time. If there is a difference of more than ten minutes, you fire your logging out routine.
Of course, you would also need to trap keystrokes in a similar same way. The principle is the same, except that you use the Keypress event.
I have simplified the above explanation. In fact, the whole thing is more complicated than you might think. For example, what if the user has minimised your app in order to use another app? Is it right to log them out in those circumstances? Or what if some unusually long background process is running, such as big database query?
Maybe it would be better to rely on the Windows screen saver to solve the problem?
Mike
__________________________________
Mike Lewis (Edinburgh, Scotland)
Visual FoxPro articles, tips and downloads