Visit our new web pages

We have launched a new extended set of web pages at www.alvechurchdata.co.uk. These old pages will stay on the server because people still have links to them but they will not be updated.

The new version of this page is at www.alvechurchdata.co.uk/hints-and-tips/foxconfig.html.

FoxPro configuration file


Visual FoxPro reads a configuration file when it starts up. This configuration file 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; FoxPro 2 used 'Config.Fp' so version 2.5 used 'fpd' and 'fpw' for the DOS and Windows versions.

Many of the parameters which are altered by the SET commands of the programming language can be initialised in config.fpw. The syntax though is slightly different.

In a program you would say:

Set Date British

whereas in the configuration file the syntax is:

Date=British

Set your configuration in program code whenever possible because it is very much easier to debug settings made in a program. There are however some parameters which can only be set in the config file. The most useful of these are:

ALLOWEXTERNAL

Set this to OFF so that Fox will not read any external config 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. 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 make the screen invisible in program code then it will flash into view and vanish as the program loads.

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.

Back to FoxPro Developers' page

Hints & tips

The textbox class in Visual FoxPro 9 has a new Autocomplete property which shows the user the previous values that have been entered in that textbox.
Autocomplete in VFP 9

Your Access database will look more impressive if you add custom toolbars...
Custom toolbars

FoxPro has always had functions to read and write files at a low level...
Foxpro low level file functions

More...
More pages of hints and tips for users of Microsoft FoxPro and Access databases.

Site Map