title: how to know Delphi application not closed correctly?
body: <p>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.</p>
  
  <p>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?</p>