Newsgroups : Borland : borland.public.delphi.nativeapi.win32 : 2005 Nov : Doing something on an unusual termination?

www.cryer.info
Managed Newsgroup Archive

Doing something on an unusual termination?

Subject:Doing something on an unusual termination?
Posted by:"Glenn" (nospamhelp@key-data.co.uk)
Date:Wed, 9 Nov 2005 13:11:16

Hi

I have a database record (Paradox) that maintains the number of concurrent
licences my users are allowed. Every time my app is started it reads the
number of available licences and reduces the number by one and write back to
database record. When all licences used no more instances of the app may be
started. When the app is closed some code runs on the 'OnCloseQuery' event
of the 'Mainscreen' to free up one licence. This works well except.......

Problem is, when my app is closed abnormally (Ctrl, Alt, Del...or system
crash etc) the code to free a licence cannot run and hence the number
available is one less and a utility needs to be run to grant the full number
of licences again.

Question: Is there some way that I can be sure the code to free a licence
runs when my app is closed in all situations?

Thanks for your time.

--
Kind Regards

Glenn Greatwood
Key-Data Systems
www.key-data.co.uk

Glossary

Replies:

www.cryer.info
Managed Newsgroup Archive