| Register | FAQ | Calendar | Search | Today's Posts | Mark Forums Read |
|
#1
| |||
| |||
| I have not been able to find any way for detecting the reasons for Form's unloading/closing. How can we find out the reason for which form is being unloaded/closed...? OnClose event is not helpful here. I have managed to list the following reasons: - User clicks on the close button - Form is told to close from code - User is logging off Windows - Windows is shutting down - User closes End Task's the program from Task Manager TIA Yogi Yang |
|
#2
| |||
| |||
| "Yogi Yang 007" <yogiyang007@gmail.com> wrote in message news:489afa38@newsgroups.borland.com... > I have not been able to find any way for detecting the reasons > for Form's unloading/closing. Because there is no such information provided anywhere for that, neither by the VCL or the OS. > How can we find out the reason for which form is being unloaded/closed...? You don't. Not programmably, anyway. > - User clicks on the close button A WM_SYSCOMMAND message with the SC_CLOSE flag specified is issued to the form. If the message reaches the default handler, a WM_CLOSE message is then issued to the form. If the form is shown modally, it closes itself and hides. Otherwise, depending on the result of the OnClose event, the form either frees itself, hides itself, or does nothing. > - Form is told to close from code That hides the window immediately, and optionally frees the form depending on result of the OnClose event. > - User is logging off Windows > - Windows is shutting down A WM_QUERYENDSESSION message is issued to the form. The OnCloseQuery event is fired. If CanClose is True, a WM_ENDSESSION message is then issued to the TApplication window, terminating the app. > - User closes End Task's the program from Task Manager The TM issues WM_CLOSE and/or WM_QUIT messages to the message queues of the process's threads. If the process does not end in a timely fashion, a brute force termination is then performed, which the application has no chance of responding that. Gambit |
![]() |
| Thread Tools | |
| Display Modes | |
In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.