Implementing session timeouts in a windows application developed using VB6.

Posted on 2005-03-15
Medium Priority
Last Modified: 2006-11-17
I am maintaining a very complex financial application that was developed using Visual Basic 6.0 and Oracle. The application contains very confidential data and must be very secure. One of the security requirements of our new client is that when a person does not use this application (not the computer) for more than a specific timeperiod (say 10 minutes), the application should verify the user by asking the password again.

Note that users may still be at the computer doing other things such as checking mails or using spreadsheets. Hence, using a screensaver is ruled out - the check has to be inside the application itself.

The application has a very rich UI and uses a variety of third-party controls for grids, list views etc.

What I need is a central way to handle all events in the application without actually having to make changes to each individuval event handler as this will amount to an enormous effort in development and testing because the application has a lot of screens.

I am open to using a hook developed using C++ or any other way of intercepting the event messages even before the event handler is called. This central place could use a variable that holds the next timeout. every call will add 20 minutes to this. When the timer goes off, the session timesout and the next access to the application can trigger user verification process. However, I dont know how this could be implemented for an application developed using Visual Basic 6.0.
Question by:pradeep_ballal
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
LVL 32

Expert Comment

ID: 13555519
Let's start simple.  If you define "not use" as the application does not have focus, then you can monitor the WM_ACTIVATEAPP message to see when your application gets and loses focus.  A timer can be used to see how long the app does not have focus.

How To Determine When Your Application Gains or Loses Focus
LVL 32

Accepted Solution

Erick37 earned 500 total points
ID: 13555654
Found something better:

Check if an Application is Idle for a Period of Time

Author Comment

ID: 13561933
That was great Erick.

The only problem that I have to tackle though, is how to show a dialog box if a modal dialog has already been displayed. For example, a messagebox has been displayed or a modal dialog waiting for user input is shown. Is there any known way to handle this?

I believe I am very close to the answer Erick. Thanks!
LVL 32

Expert Comment

ID: 13562061
Maybe make all of your MsgBoxes timed, so that they will dismiss themselves after a certain period of time.

Creating a VB-Timed Message Box with SetWindowsHookEx

Author Comment

ID: 13562084
The problem is that this application is very large and I dont want to make any code changes at this stage - as that would need additional testing effort. I will try the solution out and let you know.

Thanks Erick!.

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

801 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question