Reputation: 389
I have this simple console application in Delphi 2010 and I would like it to do something (run a piece of code) when I press the "X" button (when I close it), however I can't seem to find how to assign a close event to it. Neep help, thanks.
Upvotes: 2
Views: 1155
Reputation: 46094
You need to use SetConsoleCtrlHandler Windows API function to set your handler.
Upvotes: 5