Timer exit application

  • Thread starter Thread starter Erich
  • Start date Start date
E

Erich

Hi
I have a database in a 20 user environment. Many people do not log off so I
am forced to find out who is still in the DB when i have to repair it. I
have added a form that runs in the background that exits the application
after 3 hrs. Problem is it will close on some people when they are using
the database without warning. How can I add a warning message to pop up 5
mins prior to the application shutting down?

Thanks
Erich
 
Erich,

I have used this technique before, although not recently.

If you already have a table in the backend database with program parameters,
add a field for Maintenance (Yes/No), and MaintTime (date/time). If you
don't already have a table like this, create one.

In your version of the program, have a method that lets you set the first
paramter and define when maintenance will occur. Then, in the form that
runs in the background, check to see whether this flag is set. If it is,
display a warning message and start the count down using a static variable
in the timer event. I generally start my countdown at 10 minutes and
display a message every two minutes. I don't use msgbox, because that is a
dialog box and stops other activity until it is acknowledged. I use my own
msgbox form which opens up in normal mode rather than dialog. It contains a
timer event as well, to close itself after 20 seconds if it has not been
acknowledged. When countdown timer in your background timer reaches zero, I
step backwards through the open forms and close them after undoing the
current changes to the form.

I also have some code in the programs Splash screen that checks to see
whether the maintenance flag is set. If it does, it displays a message that
the program is currently undergoing maintenance and tells the user to try
back later, then closes the application.

HTH
Dale
 
Back
Top