When stopping an application, FireDaemon Pro attempts to stop the running application "gracefully" in preference to just killing the process. You can make sure your application shuts down gracefully by selecting "Graceful Shutdown" in the Lifecycle tab of the Service Definition editor.
FireDaemon's graceful shutdown logic works as follows:
- Top-level windows of the application are enumerated
- A WM_CLOSE is sent to each top-level window
If you enable debug logging in the FireDaemon GUI's Advanced tab, you can observe this process working successfully:
Sun May 21 09:07:58 2006 [0x118]: Ready to shutdown child, gracePeriod=5000, sleep=500 Sun May 21 09:07:58 2006 [0x118]: Window 0x00010532 belongs to this proc Sun May 21 09:07:58 2006 [0x118]: Message sent ok. Sun May 21 09:07:58 2006 [0x118]: Window 0x00010512 belongs to this proc Sun May 21 09:07:58 2006 [0x118]: Message sent ok. Sun May 21 09:07:58 2006 [0x118]: Window 0x0001050E belongs to this proc Sun May 21 09:07:58 2006 [0x118]: Message sent ok. Sun May 21 09:07:58 2006 [0x118]: Window 0x000204FC belongs to this proc Sun May 21 09:07:58 2006 [0x118]: Window is still there. Style = 0xA4CF0044. Sun May 21 09:07:58 2006 [0x118]: It's a WS_POPUP, Attempting to send an IDCANCEL Message. Sun May 21 09:07:58 2006 [0x118]: Message sent ok. Sun May 21 09:07:58 2006 [0x118]: Total no. of top level windows for the process = 4. Sun May 21 09:07:58 2006 [0x118]: CloseTheApp() complete.
In some cases, the application will not shut itself down via this method and have to be killed. You will see the following additional messages similar to this in the debug log:
Sun May 21 09:10:18 2006 [0x518]: Ckpt: 13 State: Stop-pending [3] Sun May 21 09:10:18 2006 [0x518]: Ckpt: 14 State: Stop-pending [3] Sun May 21 09:10:18 2006 [0x518]: Forcefully terminating the child process... Sun May 21 09:10:18 2006 [0x518]: Ready to terminate process: handle=448 procID=1240 Sun May 21 09:10:18 2006 [0x518]: Process terminated ok.