FoxPro configuration file
All versions of FoxPro and Visual FoxPro read a configuration file
when they start. 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;
FoxPro 2 used 'Config.Fp' so the cross-platform versions 2.5 and 2.6 used
'fpd' and 'fpw' extensions for the DOS and Windows versions.
Many of the parameters which are altered by the SET commands of the
FoxPro 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
It is better to 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 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.
|