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.
ACCESS()
, CALL()
, CATALOG()
, CERROR()
, CHANGE()
, CLEAR SCREEN
, CLOSE PRINTER
, COMPLETED()
, Convert, DExport, DGEN()
, DISPLAY HISTORY
, ID()
, ISMARKED()
, LIST HISTORY
, LKSYS()
, NETWORK()
, Protect, Reset, RUN()
, SET CATALOG
, SET DBTRAP
, SET DESIGN
, SET IBLOCK
, SET INSTRUCT
, SET LDCHECK
, SET MBLOCK
, SET PRECISION
, SET SQL
, SET TRAP
, USER()
What these commands and functions have in common is that they’re all listed in the VFP Help (one version or another) as unsupported and coming from dBase IV. However, they can actually be divided into three groups: those that give errors, those that are simply ignored but don’t give errors, and those that actually do something.
The first group, the ones that generate errors, includes CALL()
, CATALOG()
, CERROR()
, CONVERT, DEXPORT, DGEN()
, ISMARKED()
, LKSYS()
, PROTECT, RESET, RUN()
and USER()
. If you’re converting dBase code that uses these items, you’ll have to change it to get it to run.
The next group is a lot more benign, though likely to need changes, too. These items run without error, but either do nothing or do nothing useful. The members of this group are ACCESS()
, CHANGE()
, CLEAR SCREEN
, COMPLETED()
, DISPLAY HISTORY
, LIST HISTORY
, NETWORK()
and all the SET commands listed, except for SET MBLOCK
. If you’re counting on one of these commands to change something, or on one of these functions to return a meaningful value, think again. (Incidentally, all the SET commands here have SET()
counterparts that always return their hard-coded values.) The exact behavior of each of these items is listed in Help (search for “Unsupported dBASE IV Commands, Functions, and Clauses”), so we won’t get into it here.
Finally, three of these supposedly unsupported commands actually do something. CLOSE PRINTER
is equivalent to SET PRINTER
TO—that is, it turns off the printer and restores the default printer setting.
SET MBLOCK
is a little more interesting. This is a cousin to FoxPro’s SET BLOCKSIZE
command. It lets you specify the size of the chunks allocated for memo fields. However, it works a little differently (albeit more simply). The number you specify is multiplied by 64 to give the blocksize. SET(“MBLOCK”) returns the current setting, in the same scale.
ID()
may be the most intriguing of the bunch. It returns the machine identification, including information about the current user. Help says the second part is the network machine number or 1, if there’s no network, but that’s not what we’re seeing. On Tamar’s desk machine (which has a network card, but is not attached to a network), ID()
returns “TAMAR’S DELL # Tamar”, exactly the same thing as SYS(0).
? SET("BLOCK") && 64, by default
? SET("MBLOCK") && 1
SET MBLOCK TO 2
? SET("BLOCK") && 128