0

I have an Delphi application with log-in form (user and password). When the user is active in the program there is field in an MySQL database that is updated to true when application opened and updated. The field is set to false when the application is closed.

If the application is not closed correctly and the PC is shut down (not closed from main form) how can I change the parameter of log in. Or how can save the status in database or in an inifile so that I can detect if the application is not closed correctly?

1
  • 1
    When you start the application, you'll read from your database value of True, which means that the program didn't saved False when it was finished, and so that something bad happened. Commented Nov 3, 2013 at 13:56

1 Answer 1

2

You use the OnClose event of the main form.

When the application starts you record the fact that it's running (i.e. has not yet closed cleanly).
In the OnClose event handler you record the fact that it closed cleanly.
On startup you check the status.
Don't forget to commit the updates to the database or they might not get written.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.