I'm developping a vba feature in a ProcessBook display. I need some mean to check if 5 minutes have passed. We don't have a timer object in the toolbox like VB6... Any idea?
Here's the signature for a Windows call that returns the uptime of the PC in milliseconds. If you store an initial value, you can compare when 5*60*1000 milliseconds go by.
Private Declare Function GetTickCount Lib "kernel32" () As Long
My question wasn't specific enough. I need to logoff the user after 5 minute of "inactivity". Its a security requirement. What i need is something that "call me back" after 5 minutes, meanwhile the user might use the form. I cant read the time and calculate the 5 minutes because that would block the user. What i need is the asynchronous timer object from VB6 !
Can't you use a hidden form with a timer object?
Well that's kind of the question, is there a timer object in ProcessBook? Or are you talking of importing a vb6 form with the timer in it? hmmm... i'll check that.
Display_DataUpdate fires every 5 seconds. You could check the tick count there against whatever you consider the time of last activity.
Mathieu, what did you use? How did you resolve this?
If my memory is right i approached the problem differently. Rather than signing out the user after 5 min, i check how much time has passed when the next access happens. So i a keep a "last access" time to compare to. If its over 5 min, i prompt the login again.
P.S. Importing a form with the timer didn't work, the timer object just disappeared in processBook.
Thanks for the help.
This is a timer object that doesn't require a form etc - completely class-based.
There is also an Application.OnIdle event in the PB VBA object model. It gets called quite frequently when PB is idle. The same strategy as above would apply. Checking the difference between the current time and the last access time.
Retrieving data ...