Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Application timer / timeout ??
Message
 
 
To
07/10/2010 09:53:25
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01484249
Message ID:
01546887
Views:
155
>>>>>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.zip

This 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))

* liTime is the milliseconds your computer has been on.
* liLast is the milliseconds your computer was on when your last keystroke or mousemove was.

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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform