I'm coding a program for Windows, using C++Builder 2007.
When my program is closed, it is supposed to behave differently depending on how it was closed:
- User clicked the 'X' of the application's window: return to the application's user login.
- Program is terminated via TaskManager: terminate the program then and there. This is especially important as the program must not block Windows from shutting down.
Getting one OR the other is easy: Implement a TForm::OnClose()
or OnCloseQuery()
to handle the event. However, both don't give me an indication of what caused the event. Is there another way to know what actually caused the close event?