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.

 

James

 

From: fpc-pascal <fpc-pascal-boun...@lists.freepascal.org> On Behalf Of Henry 
Vermaak
Sent: Sunday, May 19, 2019 8:39 AM
To: FPC-Pascal users discussions <fpc-pascal@lists.freepascal.org>
Subject: Re: [fpc-pascal] Detecting console close with red X on windows

 

On Sun, 19 May 2019, 13:23 James Richters, <ja...@productionautomation.net 
<mailto:ja...@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.

 

Henry

_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to