I wish to save some data if the system my app is running on is shutdown.
Events like OnClose are not fired and I see, in this forum, lots of references to Application.OnEndSession but it does not work for me ??
procedure TForm1.FormCreate(Sender: TObject);
begin
Application.OnEndSession:=@OnEndSession;
end;
procedure TForm1.OnEndSession(Sender: Tobject);
var
f: textfile;
begin
assignfile(f, '/home/dbannon/CloseLog.txt');
rewrite(f);
writeln(f,'shutting down.');
closefile(f);
end;
The file, CloseLog.txt does not appear if the system is shutdown gracefully while the app is running. If I manually shut down the app thats fine, I see the log file but if the system shuts it down, nothing.
I'm using linux and most (?) of the people mentioning OnEndSession appeared to be using Windows. Is this functionality Windows only perhaps ? Or have I missed something .....
Davo