Any ideas about this scenario

Hello everyone,

My app generates records to a table every time it logs in.

This table has the following 3 fields: datetime, "login", username.

I would need to add an additional record
(equivalent to a "logout")

every time you exit the app, or if you close it from the task manager.

Any ideas on how to approach the solution?

Infinite thanks.

This extension may help:

or

(see Events)