Catch the Ctrl+C to properly exit of a TApplication

This post seems similar to what you are asking.