[fpc-pascal] Detecting console close with red X on windows
james at productionautomation.net
Sun May 19 15:32:55 CEST 2019
Could I please get an example of this? I see lots of examples of how to do it in C but when I try to translate to pascal I always struggle a quite a bit.
From: fpc-pascal <fpc-pascal-bounces at lists.freepascal.org> On Behalf Of Henry Vermaak
Sent: Sunday, May 19, 2019 8:39 AM
To: FPC-Pascal users discussions <fpc-pascal at lists.freepascal.org>
Subject: Re: [fpc-pascal] Detecting console close with red X on windows
On Sun, 19 May 2019, 13:23 James Richters, <james at productionautomation.net <mailto:james at productionautomation.net> > wrote:
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...
More information about the fpc-pascal