中国开发网: 论坛: 程序员情感CBD: 贴子 530776
pcplayer
哈哈,google 到了。真的是 delphi 的问题:
When you have a delphi application running, and you are shutting down
windows, (don't close your app first), NONE of your destructors are
called!!!!

The problem seems to be that when you close down Windows, it will first
send a WM_QueryEndSession message to all running top-level windows. This
is handled and processed correctly by the TForm object in VCL.

Then assuming that all applications indicated that it was ok to close down,
Windows will send WM_EndSession messages to all windows. This message is
not handled by VCL. The application is simply brought down with a bang.
No windows are closed, no destructor called and no exit procedures called.

The solution is to handle the WM_EndSession message yourself. There are
several ways of handling messages in Delphi, but the only reliable way
of handling the WM_ENDSESSION is to use the HookWindow method of
Application.

相关信息:


欢迎光临本社区,您还没有登录,不能发贴子。请在 这里登录