Microsoft KB Archive/110970

= Use of the ON SHUTDOWN command =

Article ID: 110970

Article Last Modified on 2/21/2005

-

APPLIES TO


 * Microsoft Visual FoxPro 3.0 Standard Edition
 * Microsoft Visual FoxPro 5.0 Standard Edition
 * Microsoft Visual FoxPro 6.0 Professional Edition
 * Microsoft Visual FoxPro 7.0 Professional Edition
 * Microsoft Visual FoxPro 8.0 Professional Edition
 * Microsoft Visual FoxPro 9.0 Professional Edition

-



This article was previously published under Q110970



SUMMARY
The ON SHUTDOWN command specifies a command that executes when you try to exit Microsoft FoxPro for Windows, Microsoft Visual FoxPro (VFP), or Microsoft Windows.



MORE INFORMATION
The command specified in ON SHUTDOWN is executed if you try to exit Visual FoxPro by double-clicking the Visual FoxPro Control-menu box, by choosing Exit from the Visual FoxPro Control menu, or by issuing the QUIT command in the Command window or in a program.

If you try to exit Microsoft Windows from the Windows Program Manager while Visual FoxPro is open, control is returned to Visual FoxPro and the command you specify in ON SHUTDOWN is executed.

The ON SHUTDOWN command is typically a DO command that executes a routine to display a dialog box. The dialog box asks if you are sure you want to exit the current application and Visual FoxPro. If you want to exit the application, the routine can close any open files, clean up the Visual FoxPro environment, and then execute the QUIT command. If you don't want to exit the current application, the routine can return control to the application.

Note If you cannot exit the development version of Visual FoxPro, try typing "ON SHUTDOWN" (without the quotation marks) in the Command window to clear the current ON SHUTDOWN command and allow Visual FoxPro to exit normally.

Command window example
  Type the following in the Command window: ON SHUTDOWN DO cleanup.prg   Create a program named CLEANUP.PRG containing the following code: WAIT WINDOW "Performing clean-up tasks" NOWAIT * Place the code here that you want to execute when it     * quits. QUIT && Force Visual FoxPro to quit  Quit Visual FoxPro by using any method.

Note The WAIT WINDOW message appears when you try to quit Visual FoxPro.

Additional query words: VFoxWin FoxWin 2.50 akz

Keywords: kbinfo KB110970

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.