>>>>>I need to add a 'timeout' feature to a VFP application.
>>>>>Basically all I need it to do is after 30 minutes of inactivity I need the application to close. Seems easy enough to create a timer object - but is there an easy way to tell if there has been any activity (mouse or keyboard) in the app?
>>>>
>>>>There is a class by Greg R that does it.
>>>
>>>Yep but the download doesn't work.
>>
>>You're right, seems to be not working - Greg has to fix his site.
>
>Thanks for the heads' up. I was not aware that the site was having problems. It seems that something most of changed at GoDaddy.com and my settings in my site was conflicting with the new change. But it is fixed now.
>
>By the way, here is a link to the tool to close a form after N minutes of idle time.
>
>
http://www.glrsoftware.com/download/download.asp?file=AutoCloseForm.zipThis is the code our timer class is using to detect inactivity:
LOCAL liTime AS INTEGER, liLast AS INTEGER, lplii AS STRING, lcLast AS STRING
liTime = GetTickCount()
lplii = CHR(8) + REPLICATE(CHR(0), 7)
lcLast = GetLastInputInfo(@lplii)
liLast = (ASC(SUBSTR(lplii, 8, 1)) * 16777216) + ;
(ASC(SUBSTR(lplii, 7, 1)) * 65536) + ;
(ASC(SUBSTR(lplii, 6, 1)) * 256) + ;
ASC(SUBSTR(lplii, 5, 1))
lnMinutesIdle = ROUND((liTime - liLast) / 60000, 1)
It doesn't seem to work well when the application is minimized.
I am wondering what is the correct code for detecting idle time?
Thanks in advance.
If it's not broken, fix it until it is.
My Blog