共用方式為


Visual FoxPro Configuration

The Visual FoxPro configuration determines how your copy of Visual FoxPro looks and behaves. For example, you can establish the default locations for files used with Visual FoxPro, how your source code looks in an edit window, and the format of dates and times.

Changes you make to the Visual FoxPro configuration can be temporary (for the current session only) or permanent (they become the default settings the next time you start Visual FoxPro). If the settings are temporary, they are stored in memory and are discarded when you quit Visual FoxPro. If you make permanent settings, they are stored in the Windows registry. The registry is a database maintained by Windows that stores configuration information about the operating system, all Windows applications, OLE, and optional components such as ODBC. For example, the registry is where Windows stores the associations between file name extensions and applications so that when you click a file name, Windows can launch or activate the appropriate application. Similarly, Visual FoxPro stores its application-specific configuration information in the registry.

For an example of how to do this, examine Registry.prg in the \Samples\Vfp7\Classes directory, which contains numerous methods based on Windows API calls making it possible for you to manipulate the Windows registry.

When you start Visual FoxPro, the program reads the configuration information in the registry and sets the configuration according to those settings. After reading the registry, Visual FoxPro also checks for a configuration file, which is a text file in which you can store configuration settings to override the defaults stored in the registry. After Visual FoxPro has started, you can make additional configuration settings using the Options Dialog Box or SET Command. For details, see Viewing and Changing Environment Settings.

Setting configuration using the Windows registry, configuration file, and Options dialog box

**Note   **The run-time version of Visual FoxPro does not read the Windows registry when starting up, as registry settings are designed primarily to configure the development environment. If you intend to distribute your Visual FoxPro applications using a run-time library, you can establish configuration settings in two ways: with a configuration file, or with a program that manipulates the Windows registry on the user's computer.

Finally, Visual FoxPro also maintains a resource file, Foxuser.dbf, which stores information about the current state of the program when you quit. For example, the resource file contains information about the location and size of the command window, current keyboard macros, which toolbars are displayed, and so on. The Foxuser.dbf file is an ordinary Visual FoxPro table, which you can read and change as required by your application.

See Also

Viewing and Changing Environment Settings | Customizing the Visual FoxPro Environment | Options Dialog Box | SET Command | ODBC Registry | Command Window | Changing Configuration Settings in the Windows Registry