[fpc-pascal] Detecting console close with red X on windows

Henry Vermaak henry.vermaak at gmail.com
Sun May 19 14:38:34 CEST 2019

On Sun, 19 May 2019, 13:23 James Richters, <james at productionautomation.net>

> Is there a way I can detect that a user has pushed the red X in the upper
> right corner to close the console window in a free pascal console
> application so I can save some files before the program terminates?
You can do that with SetConsoleCtrlHandler() and catching  CTRL_CLOSE_EVENT
in the handler.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20190519/77112079/attachment.html>

More information about the fpc-pascal mailing list