Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


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
  • 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses
Course of the Month11 days, 21 hours left to enroll

564 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