FIX: ON SHUTDOWN Command Produces "Syntax Error"

ID: Q114234

2.60 MS-DOS

The information in this article applies to:

SYMPTOMS

The ON SHUTDOWN command produces a "Syntax Error" error message when it is compiled or executed in FoxPro for MS-DOS.

CAUSE

This command is not supported in FoxPro for MS-DOS. This command is supported only in FoxPro for Windows and FoxPro for Macintosh. The concept of a shutdown event is not relevant in a single-tasking operating system such as MS-DOS.

RESOLUTION

Do not use this command in FoxPro for MS-DOS. When developing cross- platform applications, you can use the _DOS system memory variable to prevent the ON SHUTDOWN command from being executed when the code is executed under FoxPro for MS-DOS. For example:

   IF _DOS =.F.
        ON SHUTDOWN DO myprog
   ENDIF

Using this approach, the ON SHUTDOWN command will be executed only when the code is run under FoxPro for Windows or FoxPro for Macintosh.

STATUS

This problem was corrected in Microsoft FoxPro for MS-DOS version 2.6a. Because FoxPro 2.6a ignores the ON SHUTDOWN command, no syntax error occurs.

Additional reference words: FoxDos 2.60 buglist2.60 errmsg err msg fixlist2.60a KBCategory: KBSubcategory:

Keywords          : kberrmsg
Version           : 2.60
Platform          : MS-DOS
Solution Type     : kbfix

Last Reviewed: May 21, 1998