Microsoft KB Archive/109237

From BetaArchive Wiki

PRB: Resolving "APPERROR.PRG Not Found" in FoxApp Application

ID: Q109237

The information in this article applies to:

  • Microsoft FoxPro for Windows, versions 2.5, 2.5a, and 2.5b
  • Microsoft FoxPro for MS-DOS, versions 2.0, 2.5, 2.5a, and 2.5b
  • Microsoft FoxPro for Macintosh, version 2.5b

SYMPTOMS

When you are running a FoxApp-generated application, the following Program Error message box appears:

   File 'APPERROR.PRG' does not exist.

CAUSE

Given a table and a screen, FoxApp, the Microsoft FoxPro Application Generator, creates a complete application. The project that FoxApp creates is fully accessible through the project manager for further customization. If a mistake is made while the project is being customized, the FoxApp- generated application may be unable to find its resources.

In the above case, the application is unable to find the error handler procedure APPERROR, which is contained in the procedure file APPPROC.PRG. Only one procedure file can be set at a time, and in this case, a modification has been made to the application so that the SET PROCEDURE TO pointer command has been changed without restoring the original.

RESOLUTION

When you are modifying a FoxApp-generated application, consider the suggestions below, which refer to the following hypothetical procedure file:

   * User-defined procedure file named "USERLIB.PRG"
   PROCEDURE Proc1  && one of many procedures inside USERLIB
   WAIT WINDOW 'Hello, world'

1. Combine the user-generated procedure file into the FoxApp-generated

   procedure file. This file is named APPPROC.PRG. As long as the procedure
   names are unique, it is safe to include the user-defined procedures in
   APPPROC. Since FoxApp generates the same procedure file for every
   application that it creates, you can eliminate redundancy by using a
   common procedure file for all applications.

2. Maintain the user-generated procedure file and use one of the following

   methods:

   a. Instead of using SET PROCEDURE TO <user-proc-file>, specify the
      file in which the procedure exists in the DO call. For example,

         DO proc1 IN userlib.prg

      calls the procedure Proc1 in the file USERLIB.PRG.

   b. Save and restore the environment before and after every call to a
      procedure within a user-defined procedure file.

         oldProc = SET('PROCEDURE')  && Save the old procedure
         SET PROCEDURE TO UserLib    && user-defined procedure file
         DO Proc1      && call to UDF inside current procedure file
         SET PROCEDURE TO &oldProc   && restore old procedure file

      Problems will arise if the procedure file contains code that has not
      been fully tested and contains errors. If an error occurs inside a
      procedure, the original problem occurs because the current error
      handler (APPERROR.PRG) cannot be found.

MORE INFORMATION

Steps to Reproduce Problem

1. Run FoxApp.

2. Select the CUSTOMER database in the TUTORIAL subdirectory.

3. Create a new screen named CUSTOMER.

4. Generate the application.

5. Open the project associated with the application and add the following

   to the setup code of the CUSTOMER screen within the CUSTOMER screen set:

      SET PROCEDURE TO             && remove the link to APPPROC
      WAIT WOW 'This is an error'  && This is an intentional error

7. When the screen is run, an error occurs because the application cannot

   find the error routine contained within APPPROC.

Additional reference words: FoxMac FoxDos FoxWin 2.00 2.50 2.50a 2.50b errmsg err msg KBCategory: kbprg kberrmsg kbprb KBSubcategory: FxtoolProjman


Last Reviewed: June 27, 1995
© 1999 Microsoft Corporation. All rights reserved. Terms of Use.