DWUTKA at marlow.com
DWUTKA at marlow.com
Sat Feb 21 15:07:57 CST 2004
Just put Inactivity2k on my website. In Access 97, AddressOf is not a supported function, but Ken Getz wrote a function, AddrOf, where he hacked into the VBA .dll, in order to simulate VB's AddressOf capability. (AddressOf is required for callback functions). Apparently, AddressOf IS supported in A2k (and up). However, this is a BIG BIG BIG BIG BIG warning from Microsoft. (and their right, at least for A2k). Use this code ONLY in your final products, because if the VBE editor has been opened, the callback capability goes bezerk, and sends the VBE into an endless loop, which makes Access look like it has locked up. Drew -----Original Message----- From: accessd-bounces at databaseadvisors.com To: Access Developers discussion and problem solving Sent: 2/21/04 10:25 AM Subject: RE: [AccessD] Shutting down applications if they are not being used Drew, I looked at this and immediately ran into "no vba332.dll" error. I am hesitant to use a method that requires specific dlls in order to work. Is there any way to make this "generic" where it can use any vbxxx.dll instead of a specific version? John W. Colby www.ColbyConsulting.com -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com]On Behalf Of Lonnie Johnson Sent: Friday, February 20, 2004 12:40 PM To: Access Developers discussion and problem solving Subject: RE: [AccessD] Shutting down applications if they are not being used Thanks Drew, This is exciting. I am going to take a look right now. DWUTKA at marlow.com wrote: Just an FYI, I took a look at that sample database, it is is going off of the activeform/activecontrol. So, if the user doesn't change the focus from one control to another, it will still 'close' the app. Just for a simple test. Take the sample database, (hold the shift key down when starting, to bypass the startup stuff). Modify the switchboard to have a textbox control. Then restart the database. When the database opens, start typing in that textbox. 30 seconds later, it will still close the app.....not a good thing, to kick out a user, when they are still typing. Now, here's the problem. To use it's method (which is a hidden 'timer' form, watching for the active control/form), to counter the lack of movement from one control to another, you would have to put KeyPress events on all of your forms, in order to prevent the loss of activity. WORSE yet, what if a user opens a report, and is just scrolling back and forth through the data on the report. No form/control change, and blammo, the db closes on them! Now, with VBA, you can practically do anything you want. Simply because you can use API calls. You can use the SetWindowsHookEx API, to hook into a lot of stuff, including the Mouse and Keyboard. The catch is that VBA doesn't have AddressOf, but there is code on Dev Ashish's website (http://mvps.org/Access) for that. So, since I needed a break from my current work, I whipped up an example for you. Go to the Access section of wolfwares.com and download 'Inactivity.zip'. It's an Access 97 .mdb with one form, open that form, and watch the 'timer'. Don't touch anything, and the timer counts up. Move the mouse, or hit anything on the keyboard, and the timer resets. Now, it's only watching the current Access thread. I have multiple monitors, but if you don't have multiple monitors, simply resize the Access window to so that you can get to the rest of your desktop, but still see that 'timer'. Now move the mouse around your desktop, open notepad....type in there...no affect to the 'timer', it only catches stuff sent to Access. Now, my sample database doesn't shut itself down, it's only showing the length of inactivity time. I would recommend setting the Timer Interval to as large as you can go, up until the amount of activity you want to monitor. (So if you want 10 minutes of inactivity to kick out the user, set the timer to 60000, and wait until the global variable representing the last keyboard/mouse event to be more then 10 minutes from Now()). HTH, Drew -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com]On Behalf Of Lonnie Johnson Sent: Thursday, February 19, 2004 8:59 AM To: Access Developers discussion and problem solving Subject: Re: [AccessD] Shutting down applications if they are not being used Thanks William, it tried it and it works. I will have to incorporate into my situation. Thanks again. William Hindman wrote: http://www.candace-tripp.com/_pages/access_downloads.asp#13 ...Candace has a Detect and Logoff Idle Users sample mdb ...HTH :) William Hindman "My idea of an agreeable person is a person who agrees with me." Disraeli ----- Original Message ----- From: "Lonnie Johnson" To: "'MS-ACCESS-L at lists.missouri.edu'" ; "AccessDevelopers" ; "ms_access" ; "AccessD solving'" Sent: Thursday, February 19, 2004 9:05 AM Subject: [AccessD] Shutting down applications if they are not being used > Is there a general windows feature, maybe an API or something that can detect key or mouse movement? > > I want to shutdown user front end applications if no activity occurs after a certain period of time. > > Thanks in advance. > > > > Lonnie Johnson > ProDev, Professional Development of MS Access Databases > Visit me at ==> http://www.prodev.us > > > > > > > > > > --------------------------------- > Do you Yahoo!? > Yahoo! Mail SpamGuard - Read only the mail you want. > _______________________________________________ > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com > _______________________________________________ AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com Lonnie Johnson ProDev, Professional Development of MS Access Databases Visit me at ==> http://www.prodev.us --------------------------------- Do you Yahoo!? Yahoo! Mail SpamGuard - Read only the mail you want. _______________________________________________ AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com _______________________________________________ AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com Lonnie Johnson ProDev, Professional Development of MS Access Databases Visit me at ==> http://www.prodev.us --------------------------------- Do you Yahoo!? Yahoo! Mail SpamGuard - Read only the mail you want. _______________________________________________ AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com _______________________________________________ AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com