I'm working on a VCL application which communicates over bluetooth with a microcontroller and I want to execute a code right before the application terminates.
How can I detect the application is about to terminate ?
I'm working on a VCL application which communicates over bluetooth with a microcontroller and I want to execute a code right before the application terminates.
How can I detect the application is about to terminate ?
Write a handler for the
OnClose
event of your main form. The reference describes the app. shutdown notification as:The code will be executed when the form is closed by any means (other than the process being killed or segfaulting etc.)