deluvas
deluvas

Reputation: 389

Catching the exit event of a simple console application

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

Answers (1)

You need to use SetConsoleCtrlHandler Windows API function to set your handler.

Upvotes: 5

Related Questions