共用方式為


Resource Files in Applications

Visual FoxPro provides several resource files that extend the basic functionality of your applications, including FoxUser resource files, API libraries, and ActiveX controls. If you use these files, you must include them in your project or distribution tree.

The following table lists some of the files you can include in your application by adding them to your project. For more information about including files in your application for distribution, see How to: Include Files with Applications for Distribution.

If you are Add these files to your project

Applying a custom configuration to your application

Config.fpw

Applying custom settings to your application

FoxUser.dbf and FoxUser.fpt

For details about how to include files in your setup program, see the help associated with the setup creation program you are using. The setup creation program you use must create MSI setup packages using Windows Installer technology.

FoxUser.* Resource Files

Visual FoxPro resource files store useful information for your application, including window positions, Browse window configurations, and label definitions. If your application relies on specific settings for any of these resource items, you must also distribute the FoxUser database and memo files or the resource files you create specifically for your application. These resource files consist of a Visual FoxPro table with an associated memo file, usually named FoxUser.dbf and FoxUser.fpt.

Note

The FoxUser.dbf resource file is not the same as the locale-specific resource file that contains dialog boxes and error messages. The FoxUser.dbf resource file stores application information such as macros you have defined; the locale-specific resource file stores system text strings.

External Library Files

If your application includes external library files such as ActiveX controls (.ocx files) or Visual FoxPro API libraries (.fll files), make sure they are placed in the appropriate directory in your setup package. You can distribute the Visual FoxPro file FoxTools.fll with your applications. For more information on creating external libraries to access the Visual FoxPro API, see Accessing APIs.

ActiveX Controls and COM Components

If you include ActiveX controls or have created an Automation server (a COM component) as part of your application, include any .ocx and .dll files in your project and ensure the necessary support files are installed to the proper location on the user's machine.

Note

The Windows 2000 Logo guidelines do not recommend installing components to the Windows System directory. You can only distribute ActiveX controls for which you are licensed. For Automation servers, you must also include registration files, such as type libraries (.tlb files) and registry files (.vbr files), with your application.

If you use your setup creation program to create the distribution disks, you can include these files automatically. When you do this, the setup creation program ensures that COM components are registered properly on the user's computer when the application is installed. For more information on including files in your setup creation program, see the help associated with the program.

All users can run forms containing ActiveX controls; however, your application cannot accomplish certain tasks if it is running under the run-time version of Visual FoxPro. Remember the following guidelines:

  • Your application must be running under a full version of Visual FoxPro to change forms, classes, or subclasses that include ActiveX controls.

  • Your application must be running under a full version of Visual FoxPro to add ActiveX controls to forms at run time. For example, the full version of Visual FoxPro is required to add the Listview control to a form by running the following code:

    PUBLIC frmOleNewForm
    frmOleNewForm = CREATEOBJECT("form")
    frmOleNewForm.Show
    frmOleNewForm.ScaleMode = 3
    frmOleNewForm.Addobject("NewListview","OLEControl",;
       "MSComctlLib.ListViewCtrl")
    

    Note

    When a form is closed, controls added at run time are not saved.

  • Your application can be running under either the run-time or full version of Visual FoxPro to add subclassed ActiveX controls to a form at run time. For example, you can define the RedListview subclass from the Listview class, and distribute the subclass in Olelib.vcx; all users can then add the RedListview control to a form by running the following code:

    PUBLIC frmOleNewForm
    frmOleNewForm = CREATEOBJECT("form")
    frmOleNewForm.Show
    frmOleNewForm.ScaleMode = 3
    SET CLASSLIB TO CURR() + OLELIB.VCX
    frmOleNewForm.Addobject("NewListview","RedListview")
    

Configuration Files

You can use the configuration file, Config.fpw, to establish many default Visual FoxPro settings. For instance, you can change the Visual FoxPro title, the background color, and the way a user navigates with the keyboard.

If you want the configuration file to be read-only, place it in your project and mark it as included. If you want the configuration to be modifiable, place the file in your project and mark it as excluded. Distribute the configuration file with your application or executable file, as a separate file. By default, Visual FoxPro looks for a configuration file named Config.fpw. However, you can specify a different configuration file name using the -C command-line switch when starting Visual FoxPro.

For more information about options that you can set in the configuration file, see "Using a Configuration File" in Customizing the Visual FoxPro Environment.

Locale-Specific Resource Files

If you are distributing your application along with the run-time version of Visual FoxPro, you might need to include a locale-specific resource file. This file contains the dialog boxes and other user interface elements that Visual FoxPro uses to interact with the user. A different run-time resource file exists for each language in which Visual FoxPro is available.

For more information about using locale-specific run-time files, see "Distributing Locale-Specific Run-Time Files" in Developing International Applications.

Note

The locale-specific resource file is not the same as the FoxUser.dbf resource file, which stores application information such as macros you have defined. The locale-specific resource file stores system text strings.

If you are creating an application for Middle Eastern platforms, be sure to add VBAME.DLL file to your distribution set and have it installed in the Windows System directory.

Note   You cannot distribute Winhelp.exe or the Help files shipped with Visual FoxPro.

See Also

Tasks

How to: Include Files with Applications for Distribution

Concepts

Preparation for Distributing Applications
Distributable and Restricted Visual FoxPro Features and Files

Other Resources

Distributing Applications