FoxPro configuration file

All versions of FoxPro and Visual FoxPro read a configuration file when they first load. This configuration file is a plain text file and can be distributed as a separate file or built into the executable. For historical reasons FoxPro looks for a file named 'config.fpw' by default. Earlier versions up to FoxPro 2 used a file named'Config.Fp' so the cross-platform versions 2.5 and 2.6 used 'fpd' and 'fpw' extensions for the DOS and Windows versions respectively

Many of the parameters which are altered from the Command Window or at runtime by the SET commands of the FoxPro programming language can be initialised in config.fpw. The syntax though is slightly different.

The command in a program or from the Command Window to set the date format would be:

Set Date British

whereas in the configuration file the syntax is:

Date=British

In general it's better to make these configuration settings in program code because it is very much easier to debug them within a program. There are however some parameters which have to be set as Fox loads and these can only be set in the config file. The most useful of these are:

ALLOWEXTERNAL

It is possible to build the config file into the executable so that the user cannot see or alter it. Set ALLOWEXTERNAL to OFF so that Fox will not try to read an external configuration file after processing the config file built into the executable.

CODEPAGE

Set this to AUTO so that FoxPro will use the default Windows codepage.

RESOURCE

The FoxPro resource file is a table named foxuser.dbf. This is created automatically when a FoxPro executable runs and holds information such as the size, location, font and style of the FoxPro windows. It is a useful feature in the development environment but can be confusing to users. Set RESOURCE=OFF so that your application will not look for or create a resource file.

SCREEN

If you set this OFF then the main FoxPro system window will not appear at all. You should only use this option when you have designed an application with a Top Level form which can exist independently of the system window.

Using the Config file gives a better effect than setting the screen's Visible property false when the program starts. The Config file is processed before the program executes so the main FoxPro window never appears. If you were to make the screen invisible in program code then it will flash into view as the program loads and then vanish as the properties are evaluated.

Distributing the Config file

If you build config.fpw into the executable and use the ALLOWEXTERNAL option then you avoid the possibility of problems at runtime. There will be no config.fpw file for the users to edit or delete.

There is one possible danger of including config.fpw in the executable. You may find that Fox is finding and using a different version of the file when running in the design environment. Use this startup technique to make sure that your are using the correct configuration file each time.

MS Access technical tips

Visual FoxPro technical tips

General Tips

 

More tips from Alvechurch Data

Starting FoxPro

Startup options to customise the FoxPro development environment

Read More

FoxPro at development and runtime

Switching between Foxpro development and runtime

Read More

FoxPro command line switches

FoxPro command line switches

Read More

VBA Code for Events in Access

VBA Code for Events in Access

How to open the VBA code editor automatically in Microsoft Access as the default for methods.

Read More

Startup Options for a Microsoft Access database

Different ways of using the Access StartUp options to improve database security

Read More