Logo

Hacker’s Guide to Visual FoxPro
An irreverent look at how Visual FoxPro really works. Tells you the inside scoop on every command, function, property, event and method of Visual FoxPro.

Exclude

This property indicates whether a file gets built into a project or is simply listed there for reference.

Usage

lExcluded = filFile.Exclude
filFile.Exclude = lExcluded

Projects are not just a container to let you see what files are used in a project. When you build a project into an APP, EXE or DLL, the files in the project become part of that result file. That is, they do unless they’re excluded from the project. You can recognize excluded files because they have the international “not” symbol next to them in the Project Manager.

Why would you exclude a file? The most common reason is because it’s a data file. Files included in the application are read-only. Because you generally do want users to be able to modify the data in your tables, it’s wise to exclude tables from the project. But why bother putting them in the project at all, just to mark them as excluded? Because it gives you quick access to them when you’re working on the project.

You should exclude certain other files from a project as well, including libraries (DLLs and FLLs). By default, data files and libraries are excluded when they’re added to a project.

Exclude lets you find out whether a file is excluded and gives you a programmatic way to change the setting. You can include or exclude any file except whichever file is set as the main file for the project. Not surprisingly, VFP insists that that one be included.

In the initial release of VFP 7, the Exclude property isn't updated properly when it's changed through the user interface. You have to close and reopen the project to have the interaction change reflected. This bug is fixed in Service Pack 1.

Example

* Check the Exclude status of all files in the project.
FOR EACH oFile IN _VFP.ActiveProject.Files
   ?oFile.Name+" is "+IIF(oFile.Exclude,"not ","")+"included."
ENDFOR

See Also

File, Files, MainFile, Project