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.

SET RESOURCE, Sys(2005), Set(“Resource”)

Usage

SET RESOURCE [ ON | OFF ] | [ TO FileName ]
cFileName = SET( "RESOURCE" ) | SYS( 2005 )

The FoxPro resource file, by default named FOXUSER.DBF, stores the size and position settings of all windows and toolbars. It also stores diary entries, and other miscellaneous entries such as the location of the builder registration table and the most recently used projects. Earlier versions of FoxPro used this file to store additional information such as printer settings, label layouts, and other data used only for the DOS product.

Nowhere does it say that you have to use a resource file. While it is nice to let your users resize windows and have them reappear in the same place, it does add another management issue to your application framework. Many cool features, like color sets and printer drivers, useful in the DOS product, have been assumed by the operating system. Unless your users have a need for it, consider delivering your application to them with SET RESOURCE OFF. Saving and restoring form positions is easily accomplished in your base classes, and you can eliminate the hassle of managing resource files.

A FoxPro resource file is opened exclusively by the first user to get to it, and cannot be shared. Our usual method of handling this is to bundle a “seed” resource file within our application, and install a copy of this file for each user.

Because every window that’s been opened stores a record within this file, we regularly browse the file and clean out deadwood, packing the file.

SET(“RESOURCE”) returns the current status, ON or OFF, and SET(“RESOURCE”,1) and the synonymous SYS(2005) return the path and filename of the current resource file. We prefer the first format, SET(“RESOURCE”,1), because it’s a wee bit more self-documenting.

Example

SET RESOURCE OFF
SET RESOURCE TO C:\MYAPP\MYRSRC.DBF

See Also

Calendar/Diary, Configuration Files