| **Navigation:**  [[templates.htm|Templates]] > Guide to all Templates > Extension Templates >====== CleanCloseDown Global Extension ====== | [[tplextensionblobincontrol.htm|{{btn_prev_n.gif|Previous page}}]][[templates.htm|{{btn_home_n.gif|Return to chapter overview}}]][[communications email sms.htm|{{btn_next_n.gif|Next page}}]] | | || (ABC Template Chain Only) This extension template is used to include the CleanCloseDown( ) procedure prototype that can be used in any procedure to cleanly close down your application. {{notebox.jpg|NoteBox.jpg}} This template also requires the global [[tplextensionframeextension.htm|FrameExtension Template]] A clean closedown is defined as the proper and automatic shutdown of any application, regardless of the state of the application. For example, if a user leaves the office with an application running, and a form procedure is open, the **CleanCloseDown** procedure, when called on a timer event, can shut down the application //without user intervention//. This global extension automatically includes a local extension for every procedure in your application that incorporates a WINDOW structure. To use this template, simply call the **CleanCloseDown() **procedure from any embed point. Normally this would be from a TIMER event on any window. The **CleanCloseDown**( ) procedure is simple, and takes advantage of the proper method to close down a program in a multi-threaded environment with the proper use of the NOTIFY language statement: **CleanCloseDown PROCEDURE()** **CODE** **MESSAGE('BYE')** **GLO:CleanCloseDown = True** **NOTIFY(NOTIFY:CloseDown,GLO:CleanCloseDownMainThread)** {{notebox.jpg|NoteBox.jpg}} **When using this template in your application, the following global variables are internally defined:** ** ** **GLO:CleanCloseDown           BYTE(0)** **GLO:CleanCloseDownMainThread LONG** The only template prompt available is the ability to **Disable Clean Close Down **when testing its compatibility with other third-party templates. {{notebox.jpg|NoteBox.jpg}} In multi-DLL applications, you will also need to include the global extension in any DLL target application that will need to use the **CleanCloseDown** procedure.