Article ID: 160919 - Last Review: December 3, 2003 - Revision: 3.1

PRB: Cannot Call Suspend with the On Shutdown Command

This article was previously published under Q160919

On This Page

Expand all | Collapse all

SYMPTOMS

When you type the Suspend command in an On Shutdown procedure, the following error message appears:
CANCEL or SUSPEND is not allowed.
In order to quit Visual FoxPro, the On Shutdown command must be cleared by typing the "ON SHUTDOWN" (without quotation marks) command in the Command window.

CAUSE

This behavior is by design.

RESOLUTION

Place the Suspend command in an event that occurs before Visual FoxPro actually begins to shutdown, as in the Destroy event of a form.

MORE INFORMATION

When you exit Visual FoxPro, you trigger the On Shutdown command. Once Visual FoxPro begins removing itself from memory, you cannot type the Suspend command.

Steps to Reproduce Behavior

  1. Create a program called Test.prg.
  2. Type the following two lines of code:
          ON SHUTDOWN SUSPEND
          QUIT
    						
  3. Run the program and the error message appears.
  4. Select Cancel from the error dialog. Now when you try to close Visual FoxPro the error message will appear.
  5. Type the following command in the Command window and press ENTER:
          ON SHUTDOWN
    						
    Now you will be able to close Visual FoxPro.

APPLIES TO
  • Microsoft Visual FoxPro 3.0 Standard Edition
  • Microsoft Visual FoxPro 3.0b Standard Edition
  • Microsoft Visual FoxPro 5.0 Standard Edition
  • Microsoft Visual FoxPro 6.0 Professional Edition
Keywords: 
KB160919
 

Article Translations