I want to prevent the user from closing the application.
When windows closes I want the application to do some tasks then close and then windows close.
In Form1.FormCloseQuery is CanClose := false; // user cannot close the app.
Form1.CanClose := true; // No such variable.
Application.CanClose := true; // No such variable.
Application.Terminate needs CanClose to be true but I cannot find a way to set it true, it doesn't seem to be a property of the form or of the application.