Title: Configuration of FoxPro for Windows
Author: Dean Christopher
Last saved by: Janet Manuel

Chapter 5 : Configuring Microsoft FoxPro for Windows 2.5x

Microsoft FoxPro Support Engineers
Microsoft Corporation

Created: December 15, 1993
Abstract

This section discusses configuring Microsoft FoxPro for Windows version 2.5x, and contains the following topics:
•	Introduction
•	CONFIG.FPW
•	Memory
•	Startup Speed
•	Third-Party Drivers
•	Video Drivers
•	Common Errors
•	Additional Information
Introduction

Several variables come into play when configuring FoxPro for optimal performance. These include:

•	The CONFIG.FPW or custom configuration file
•	The amount of available memory on the machine
•	The MS-DOS environment
•	Third-party drivers, including video and printer drivers
•	Video resolution

This section will examine each of the above variables in further detail.
CONFIG.FPW

The CONFIG.FPW is FoxPro’s configuration file. This file is created during installation and normally contains one statement (i.e. KEYCOMP=<DOS or Windows> depending on the option chosen during installation). 

Although CONFIG.FPW is the default file, you can create your own configuration file and specify it’s location. You can also enter many of the FoxPro SET commands into the configuration file and direct the output location of temporary files.
Specifying the Location

When FoxPro is started it searches for a configuration file in the following sequence:
1.	Checks for start-up switches used on the command line with FOXPROW.EXE.
2.	Checks the MS-DOS environment variable FOXPROWCFG for a configuration file name and location.
3.	Checks the current working directory.
4.	Checks the Microsoft FoxPro for Windows directory.
5.	Checks the MS-DOS path.
6.	If no configuration file is found, Microsoft FoxPro for Windows uses the built in system defaults.

You can specify the name of your configuration file by including an optional switch in the Program Item Properties dialog box in the Windows Program Manager.
1.	Select the FoxPro icon in the Program Manager Window.
2.	Choose Properties... from the File menu.
3.	Add the '-C' switch, plus the path and configuration file name to the end of the file name in the Command Line text box. For example, if your configuration file was located in the TEST subdirectory, your command line would look like the following:

\FOXPROW\FOXPROW.EXE -CC:\CONFIG.FPW

IMPORTANT:     Make sure you do not enter any spaces after the '-C' switch.
4.	Choose OK.

You can also include the following line in the AUTOEXEC.BAT file to specify a configuration file:
SET FOXPROWCFG = C:\CONFIG.FPW
SET Commands

FoxPro allows you to customize your working environment through the use of SET commands. These commands are entered in either the CONFIG.FPW or your custom configuration file. When SET options are used in the configuration file, the correct format is:

<item>=<value>

For example, if you wanted to have the Windows-style status bar on, the bell off, and run a program called 'welcome.prg', your configuration file may contain these settings:
STATUSBAR = ON
BELL = OFF
COMMAND = DO C:\FOXPROW\PRGS\WELCOME.PRG

NOTE:     Only one COMMAND= line will be evaluated in the configuration file.
If you enter an incorrect value in the configuration file, FoxPro will ignore the statement. You will not receive a message that an error has occurred. For additional information on the CONFIG.FPW and the SET commands, see pages 2-4 to 2-16 of the "Installation and Configuration" guide for FoxPro for Windows.
Memory

The minimum memory requirement for Microsoft FoxPro for Windows is 4 MB of RAM. If, however, other applications are running simultaneously, this 4 MB of RAM must be divided  among all applications, and you may receive an “Insufficient Memory" error message. 
Virtual Memory

One way to allocate more memory to FoxPro and other Windows applications is through the use of virtual memory. This is a method that uses your hard disk as RAM. Virtual memory is slower than RAM, random access memory, because of the hard drive I/O involved. See the section titled "Insufficient Memory or Not Enough Memory for Applications" below for more complete information on virtual memory settings.
MEMLIMIT

FoxPro will ask Windows for 1.25 MB of any kind of memory if MEMLIMIT is not set in the CONFIG.FPW file. With the MEMLIMIT command, you can specify the amount of real memory Windows gives Microsoft FoxPro for Windows. MEMLIMIT allows you to allocate a percentage of available memory by including the following statement in the CONFIG.FPW file:
MEMLIMIT =<% of available memory>,[<Minimum memory requested (K)>],[<Maximum memory limit (K)>]

For example, if you want to run FoxPro for maximum performance without regard to other Windows applications, the MEMLIMIT statement could appear as follows:
MEMLIMIT = 85

This would allocate 85 percent of the memory available under Windows to FoxPro, and by doing so, would limit the number of other applications that could be open at the same time.
The algorithm MEMLIMIT uses is:

Startup Speed

The majority of the startup time for FoxPro is used to search directories and the MS-DOS path for necessary files. The steps below will decrease startup time.
1.	Move FOXPROW to the beginning (directly behind Windows) of the MS-DOS search path in your AUTOEXEC.BAT file.
2.	Use a CONFIG.FPW file in the FoxPro directory. If this is not possible, specify the full path to the configuration file using the SET FOXPROWCFG= command in the AUTOEXEC.BAT file or the -c parameter on the FOXPROW command line in the Program Manager Properties dialog box.
3.	Use a resource file that is in the FoxPro directory, or specify the full path in the CONFIG.FPW file.
	For example:
RESOURCE = C:\FOXPROW\FILES\FOXUSER.DBF
4.	Other components of FOXPROW are searched for only in the FOXPROW directory. If they are located elsewhere, a specific location must be given in the CONFIG.FPW file. 
For example:
HELP = C:\TEST\HELP 
5.	A complete list of the files FoxPro looks for upon startup is available on page 3-10 of the "Installation and Configuration" guide. 
6.	If none of the listed files are to be used, set them to null in the CONFIG.FPW file.
For example: 
GENSCRN = "" 
7.	Temporary files are automatically stored in the Windows temporary directory. Make sure that this directory is valid. If the files are to be stored elsewhere, their location must be specified in the CONFIG.FPW file. 
For example: 
TMPFILES=C:
EDITWORK=C:\WINDOWS\TMPFILES
SORTWORK=C:\WINDOWS\TMPFILES
PROGWORK=C:\WINDOWS\TMPFILES
8.	If you are using MS-DOS 6.0 or later and loading the EMM386.EXE memory manager, you can add the NOVCPI option to the EMM386.EXE line in the CONFIG.SYS file. The NOVCPI switch must be used in conjunction with the NOEMS switch. 
For example:
DEVICE=C;\DOS\EMM386.EXE NOEMS NOVCPI
	These switches tell EMM386.EXE not to load VCPI services, forcing FoxPro to go directly into extended memory.
Third-Party Drivers

If you are using... | ...and your network card uses a RAM address, try putting this in the [386Enh] section of your SYSTEM.INI file.
LANtastic(R) network card | emmexclude=d800-dfff
Paradise video driver | emmexclude=c600-c800
QEMM386 memory manager | emmexclude=c0ff-c7ff
Video Drivers

FoxPro for Windows makes intensive use of screen I/O and requires that video drivers support a complete implementation of the Windows video driver standard. If you experience general protection (GP) faults or display problems with borders, status bars, fonts, or unusual alignment when you preview reports, you may have a problem with your video driver.

To test for video driver problems, load one of the standard Windows video drivers (ex: VGA) and go through the steps to reproduce the problem. If the problem no longer exists using a standard Windows video driver, it's very likely your video driver is the cause of the problem. Contact the vendor for an updated version of the driver or download the Windows Driver Library (WDL) located on the Microsoft Download Service (MSDL). The telephone number for accessing the MSDL is (206) 936-6735.

We have identified problems with the following video card drivers:
•	ATI Ultra Graphics Pro (local bus) - caused GP fault, fixed with update.
•	AST(R) Power Premium 486 w/VGA on motherboard, fixed with update.
•	COMPAQ(R) QVision
•	Dell(R) 486/20 with VGA on motherboard
•	Genoa 7900 MM card
•	MACH32
•	MATROX MGA video driver using 1024 x 768 resolution
•	NEC(R) 2A
•	Orchid Fahrenheit 1280 card using Microsoft Windows version 3.1
•	Speed Star 24x
•	TIGA(R) 1024 x 768 x 256 small fonts 
•	Trident 8900C
Common Errors

Below is a listing of common memory related and configuration related errors and the steps to resolve them.
Memory Related Errors

•	Internal consistency error.
•	Resource Manager Internal consistency error.
•	Menu Manager Internal consistency error.
•	1004 Use of invalid handle.
•	1005 Use of unallocated handle.
•	1006 Use of transgressed handle.
•	1007 Transgressed node found during compaction.
•	1008 Foreign node found during compaction.
•	1009 Incorrect handle found during compaction.
•	1010 Area size exceeded during compaction.
•	1011 Area cannot contain handle.
•	Any error message listed in the FoxPro Developer's Guide or in the on-line help that states "Please Call Technical Support"
•	Known video drivers that may cause a general protection (GP) faults in Windows
•	Other general protection faults in FoxPro for Windows or Windows.

After one of the above memory error messages occur, FoxPro closes all open files and exits to Windows in an attempt to preserve the data in the files that were open. 

The following steps may be used to resolve these conflicts.
•	Perform a “clean boot” of the machine. For information on a “clean boot”, see the section on "How to Perform a 'Clean Boot’ for FoxPro" in this Resource Kit.
•	Disable any video or system ROM (Read Only Memory) shadowing. 
	Run CHKDSK /F from the MS-DOS prompt. If any lost chains or clusters are detected on the hard disk, you will be prompted whether you wish to save the chains to files or erase the information. See the MS-DOS manual for more details on CHKDSK.
•	If you are running FoxPro for Windows on a Novell network, ensure that you are using NETx driver instead of either the EMSNET or XMSNET drivers.

File corruption may also cause a memory error. If you suspect a corrupted file, do the following:
1.	If the .CDX file is corrupted, the following steps will solve the problem:
From the MS-DOS prompt, enter the following command:
RENAME <filename>.cdx <filename>.cbk
From the command window in FoxPro enter the following command:
USE <filename>.dbf
Recreate the .CDX file.

2.	If the .DBF file is corrupted, the following steps will solve the problem:
Restore the backup .DBF file if a backup was made.
From the command window in FoxPro enter the following commands:
USE <filename>.dbf
COPY STRUCTURE TO test.dbf WITH CDX
USE
SELECT <an unused work area>
USE test.dbf
SELECT test.dbf
APPEND FROM <filename>.dbf

NOTE:     If you receive a “Not a Database File” error message when trying to open the .DBF, the file header has been corrupted. You will need to restore from a backup or use a third party utility to correct the header record.

3.	If the FoxPro resource file, the FOXUSER.DBF, is corrupted, the following steps will resolve this problem:
From the MS-DOS prompt, enter the following command:
RENAME FOXUSER.DBF FOXUSER.DBK
Restart FoxPro and a new FOXUSER.DBF file is automatically created by FoxPro.
4.	In the case of a distributed application, the ".ESL" file may be corrupted. Replace the support library to resolve this problem. 
5.	Reinstall FoxPro. 
6.	Check the machine for a bad memory board or chips.
7.	Make sure you are running the most current version of FoxPro
Configuration Related Errors
Insufficient Memory or Not Enough Memory for Application

The following error messages indicate FoxPro for Windows does not have enough virtual memory to start:

•	"Insufficient memory"
•	"Not enough memory for application (minimum 2187264 required)", This is produced only in FoxPro for Windows version 2.5.
•	"Not enough memory for application (minimum 2158592 required)", This error is produced only in FoxPro for Windows 2.5a.

Virtual memory is a technique used by Windows to simulate additional memory for an application to use. Applications access the memory through virtual addresses, which are mapped to physical addresses on the disk. If you receive one of the above error messages, use one of the following methods to increase the amount of virtual memory:

1.	Increase the size of the Windows swap file. In Windows 3.1, do the following:
	From the Main group in Program Manager, run Control Panel, and then choose the 386 Enhanced icon.
	Choose the Virtual Memory button.
	Choose the Change button. 
	Select the type of virtual memory you want to use (Temporary or Permanent) from the Type list box, then enter a larger size in the New Size box. The new swap file does not take effect until Windows is restarted. 
2.	If an Expanded Memory Specification (EMS) emulator is in use, remove it or reduce the amount of expanded memory it provides. EMM386.EXE, provided with MS-DOS and Windows, has this emulation capability. 
3.	Reduce the size of your disk-caching software. Windows cannot use XMS memory that a disk cache is using. SMARTDRV.EXE is the disk cache provided with MS-DOS and Windows. 
4.	Reduce the minimum amount of memory allocated to FoxPro for Windows by the MEMLIMIT statement in the CONFIG.FPW file. 
5.	Increase the percentage of available memory allocated to FoxPro for Windows in the MEMLIMIT statement in the CONFIG.FPW file. 
6.	Verify a valid path exists for the temporary files that FoxPro creates, and that there is at least 5 MB of room available for the creation of these temporary files.
"Sharing Buffers Exceeded" or "System Resources Exhausted"

When you are running FoxPro version 2.5 on a network workstation, the above error messages may occur. To resolve the problem, do the following:

1.	Increase the number of files in the CONFIG.SYS file to at least 100.
2.	Include a HIMEM.SYS command in the CONFIG.SYS file and add the /NumHandles=128 parameter to the HIMEM.SYS command.
3.	Add /F:5120 /L:500 to the SHARE.EXE command in the AUTOEXEC.BAT file.
4.	Turn off any disk-caching utilities, since these might cause FoxPro to lock up or corrupt files. 
5.	On a Novell network, increase the FILE HANDLES line in the SHELL.CFG or NET.CFG.
"File in Use by Another" Errors in Networked FoxPro

When running FoxPro across a network, and you receive the following error message, "File in use by another", it is because the files are locked by another user on the network. To work-around this error, try the following resolutions:

1.	Verify that each user has EXCLUSIVE set to OFF. This command must be issued prior to either user opening the database file. 
2.	On a peer-to-peer network, also do the following:
	Change the attributes of the FoxPro and .EXE files to read-only.
	Load the MS-DOS SHARE utility on both the workstation and the server. Specify the /F:5120 and /L:500 parameters to increase the file space in bytes for the MS-DOS file sharing storage area and to set the number of files that can be locked at once.
	Share the FoxPro FOXUSER database by marking the file as read-only.
How to Resolve "Too Many Files Open" Error

When running FoxPro on a network, you may receive the error message "Too many files open". If this occurs, perform the following three steps on both the server and workstation computers to address this situation:

1.	Check the FILES statement in the CONFIG.SYS file to ensure that it does not contain any spaces and that there are enough files specified (FILES=60 is a good starting point). 
2.	In a Novell network environment, check the FILE HANDLES statement in the SHELL.CFG file (for example, FILE HANDLES=90). 
3.	If the CONFIG.SYS file loads the SHARE utility, modify the F and L parameters to specify a greater number of files and locks (for example, SHARE /F:5120 /L:500).
Cannot Create Program Workspace

The error message "Cannot Create Program Workspace" is generally caused by:

•	Pointing temporary files to an invalid directory.
•	Pointing temporary files to a read-only directory
•	Pointing temporary files to a drive that does not have adequate disk space.

The temporary files should be pointed to an existing directory where the user has read/write/create/modify privileges. The location where temporary files are stored can be set through the CONFIG.FPW file.

For example: 
TMPFILES=C:
EDITWORK=C:\WINDOWS\TMPFILES
SORTWORK=C:\WINDOWS\TMPFILES
PROGWORK=C:\WINDOWS\TMPFILES

If the error occurs even though the temporary files have been directed as described above, the SET FOXPROWCFG line in the AUTOEXEC.BAT file may not be getting executed during boot up. On a network installation this line is inserted by ADDUSER.APP and points to the CONFIG.FPW file. If it has been placed in the AUTOEXEC.BAT file after a command such as WIN (to start Windows), it will not execute. If FoxPro cannot find a CONFIG.FPW file, it will point any temporary files to its default directory. If that default directory is marked read-only, the error will occur. To determine if this is the problem: 

1.	Open CONFIG.FPW and look for the following lines: 
EDITWORK = <drive>:\<directory>
SORTWORK = <drive>:\<directory>
PROGWORK = <drive>:\<directory>
TMPFILES = <drive>:\<directory>
Verify the location of the directories and the syntax of each line.

IMPORTANT:     If FoxPro is on a network, make sure that you have read/write privileges to <directory>. Point the temporary files to a local drive if possible. 

2.	At the MS-DOS prompt, change to the directory in question to make sure that it exists. The CONFIG.FPW file does not create directories. 
3.	Open the AUTOEXEC.BAT file. Check the placement of the following line. It should not follow the WIN command or any other command that starts a program.

set FOXPROWCFG=<drive>:\config.fpw
Resolving FoxPro "Sharing Violation Reading Drive" Error 

To correct the error "Sharing violation reading drive X" (where X is the drive letter for a network drive):

1.	Verify that each user has their own FOXUSER.DBF file. If users are sharing a FOXUSER.DBF, make sure that it and the FOXUSER.FPT are marked read-only 
2.	Verify that the CONFIG.FPW file on the server includes the EXCLUSIVE=OFF statement. If EXCLUSIVE=OFF is used, then it is possible to share database files.
3.	Mark the FOXPROW.EXE file as read-only. 
4.	If you use the Distribution Kit to create a standalone application, verify that the .EXE and .ESL files are marked as read-only.
5.	In some cases, the SHARE utility must be loaded on the server and on each workstation. Specify the /F and /L parameters as follows: 
SHARE /F:5120 /L:500
Additional Information
Additional information concerning configuring FoxPro for Windows can be found by looking at the following articles:

Q95709 | |
Q105007 | |
Q102787 | |

CONFIG.DOC	12/7/93