>>What about the original question, though - how do you detect the application being killed from the Task Manager? Would object's Destroy method still fire?
>
>I guess that would depend on why is it being killed. If it's stuck in a tight loop, or stuck waiting for the OS to return something, I wouldn't expect even bindevent() to the system messages to have any effect. If it's stuck in a wait state (with focus on an off-screen dialog or something, i.e. waiting for user input which cannot happen), then maybe.
I was thinking a bit about the problem. If the destroy of the main application object happens when the application is being killed from the Task Manager, then it's easy to find out when the application has been killed. If not - there needs to be some kind of watcher application, which doesn't sound like a good solution to me.
If it's not broken, fix it until it is.
My Blog