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.
SYS() Functions
What would a new version of VFP be without a half-dozen or more new SYS() Functions
? There are now 131 known SYS() Functions
in VFP 7. Yikes! That’s as many relatively obscure numbers as some entire languages have functions!
Fortunately, IntelliSense really helps out here: When you type “SYS(“, VFP displays a list of all the functions (well, not all of them; in fact, only 86 of them appear in the list), showing not only the number but also a short description for each and a longer tool tip for the selected one.
SYS() Functions
are an odd lot. They really have very little in common, other than they almost always return a character value (even when you’d expect a numeric one). We think they creep into the language when the VFP team can’t think of a reasonable name to assign to a “real” function.
Some of these functions really should be avoided because they’ve been superseded with “real” functions that do the same or almost the same thing but are much more readable. For example, which would you rather see in code: SYS(2003) or CURDIR()
? SYS(2001) or SET()
? SYS(22) or ORDER()
? In addition, some of these are just plain obsolete: They do nothing at all in VFP. There’s also a whole bunch of these that return a value (or at least don’t cause an error) but are completely undocumented. We suspect these are used for internal purposes or VFP system testing and aren’t really intended for us to use.
The following table lists every SYS() function grouped by category.
Category |
Function |
Description |
Get System or VFP Information |
SYS(0) |
Network machine information |
SYS(1) |
Julian system date |
|
SYS(2) |
Seconds since midnight |
|
SYS(5) |
Default drive or volume |
|
SYS(9) |
VFP serial number |
|
SYS(10) |
String from Julian day number |
|
SYS(11) |
Julian day number |
|
SYS(16) |
Executing program filename |
|
SYS(17) |
Processor in use |
|
SYS(18) |
Current control |
|
SYS(602) |
Bitmap configuration |
|
SYS(1001) |
VFP memory |
|
SYS(1011) |
Number of memory handles |
|
SYS(1016) |
User object memory in use |
|
SYS(2011) |
Current lock status |
|
SYS(2012) |
Memo field block size |
|
SYS(2013) |
System menu name string |
|
SYS(2018) |
Error message parameter |
|
SYS(2019) |
Configuration file name and location |
|
SYS(2020) |
Default disk size |
|
SYS(2022) |
Disk cluster size |
|
SYS(2023) |
Temporary path |
|
SYS(2029) |
Table type |
|
SYS(3053) |
ODBC environment handle |
|
OOP-Related |
SYS(1270) |
Object location |
SYS(1271) |
Object's SCX file |
|
SYS(1272) |
Object hierarchy |
|
COM-Related |
SYS(2333) |
ActiveX dual interface support |
SYS(2334) |
Automation server invocation mode |
|
SYS(2335) |
Unattended server mode |
|
SYS(2336) |
Critical section support |
|
SYS(2339) |
Call CoFreeUnusedLibraries when COM object is released |
|
SYS(2340) |
NT service support |
|
SYS(3095) |
IDispatch pointer |
|
SYS(3096) |
IDispatch object reference |
|
SYS(3097) |
Add reference to object |
|
SYS(3098) |
Release object reference |
|
International Support |
SYS(15) |
Character translation |
SYS(20) |
Transform German text |
|
SYS(2300) |
Add or remove codepage |
|
SYS(3004) |
Return locale ID |
|
SYS(3005) |
Set locale ID |
|
SYS(3006) |
Set language and locale IDs |
|
Perform an Action or Update a Setting |
SYS(1023) |
Enable help diagnostic mode |
SYS(1024) |
Disable help diagnostic mode |
|
SYS(1037) |
Display Page Setup dialog |
|
SYS(1104) |
Purge cached memory |
|
SYS(1500) |
Activate a menu item |
|
SYS(2030) |
Enable/disable system component debugging |
|
SYS(2600) |
Memory "peek" or "poke" |
|
SYS(2800) |
Enable/disable Accessibility support |
|
SYS(2801) |
Extend event tracking support |
|
SYS(3050) |
Set buffer memory size |
|
SYS(3051) |
Set lock retry interval |
|
SYS(3052) |
Override SET REPROCESS locking |
|
SYS(3054) |
Rushmore optimization level |
|
SYS(3055) |
Specify FOR and WHERE clause complexity |
|
SYS(3056) |
Reread Registry settings |
|
SYS(4204) |
Enable/disable Active Document debugging support |
|
Miscellaneous |
SYS(3) |
"Unique" file name |
SYS(2007) |
Checksum value |
|
SYS(2014) |
Minimum path |
|
SYS(2015) |
Unique procedure name |
|
Obsolete |
SYS(12) |
Available memory |
SYS(13) |
Printer status |
|
SYS(23) |
FoxPro EMS memory usage |
|
SYS(24) |
EMS memory limit |
|
SYS(2006) |
Current graphics card |
|
SYS(2008) |
Cursor shape |
|
SYS(2009) |
Swap cursor shape |
|
SYS(2010) |
CONFIG.SYS file settings |
|
SYS(2016) |
SHOW GETS WINDOW name |
|
SYS(2017) |
Display sign-on screen |
|
SYS(2027) |
Convert DOS paths to Mac notation |
|
Superseded With "Real" Function |
SYS(6) |
Current printer device; use SET('PRINTER', 1) |
SYS(14) |
Index expression; use KEY() |
|
SYS(21) |
Controlling index number; use TAGNO() |
|
SYS(22) |
Controlling tag or index name; use ORDER() |
|
SYS(100) |
Console setting; use SET('CONSOLE') |
|
SYS(101) |
Device setting; use SET('DEVICE') |
|
SYS(102) |
Printer setting; use SET('PRINTER') |
|
SYS(103) |
Talk setting; use SET('TALK') |
|
SYS(1269) |
Property information; use PEMSTATUS() |
|
SYS(2000) |
Filename wildcard match; use ADIR() |
|
SYS(2001) |
SET command status; use SET() |
|
SYS(2002) |
Turn insertion point on or off; use SET CURSOR |
|
SYS(2003) |
Current directory; use CURDIR() |
|
SYS(2004) |
VFP start directory; use HOME() |
|
SYS(2005) |
Current resource file; use SET('RESOURCE', 1) |
|
SYS(2021) |
Filtered index expression; use FOR() |
|
Unknown Purpose |
SYS(1002) |
|
SYS(1003) |
||
SYS(1004) |
||
SYS(1005) |
||
SYS(1006) |
||
SYS(1007) |
||
SYS(1008) |
||
SYS(1009) |
||
SYS(1010) |
||
SYS(1012) |
||
SYS(1013) |
||
SYS(1014) |
||
SYS(1015) |
||
SYS(1017) |
||
SYS(1022) |
||
SYS(1039) |
||
SYS(1101) |
||
SYS(1102) |
||
SYS(1103) |
||
SYS(1105) |
||
SYS(2024) |
||
SYS(2025) |
||
SYS(2026) |
||
SYS(2050) |
|
|
SYS(2400) |
|
|
SYS(3090) |
|
|
SYS(4000) |
||
SYS(4001) |
||
SYS(4003) |
||
SYS(4004) |
||
SYS(4010) |
||
SYS(4015) |
||
SYS(4201) |
||
Meant for Microsoft Fox Team Use |
SYS(999) |
Cycles through all the built-in dialogs so spelling or translation can be checked. |
SYS(1018) |
Returns "Hold Index Lock during TableUpdate: " followed by "On" or "Off"; pass 0 to get "Off" or 1 for "On" (the default is "On"). |
|
SYS(1020) |
Turns off the diagnostic mode turned on by SYS(1021). |
|
SYS(1021) |
Starts some kind of diagnostic mode, which is turned off by SYS(1020). |
|
SYS(1029) |
Pass 0 to move the Format menu to the end, and add the Database and Record pads. Pass 1 to restore the menu. Doesn't work under all conditions. |
|
SYS(2901) |
Causes exception code C0000005 (formerly known as a General Protection Fault or GPF) if you pass 3045. This is on purpose; it allows the Fox team to test exception code handling. You may want to consider avoiding this one in your finished applications! |
|
SYS(3070) |
"Icecap profiling turned on" displays in the status bar. We're not sure what that means, but we don't want to mess with it. Doesn't work under all conditions. |
|
SYS(3071) |
"Icecap profiling turned off" displays in the status bar. See SYS(3070), directly above. Doesn't work under all conditions. |
We suspect that many of the undocumented SYS() Functions
are there to aid the Fox team in testing and debugging. A lot of them return intriguing values, but we haven’t (yet) hacked out their meanings.
Sys(0), Sys(1), Sys(10), Sys(100), Sys(1001), Sys(101), Sys(1011), Sys(1016), Sys(102), Sys(1023), Sys(1024), Sys(103), Sys(1037), Sys(11), Sys(1104), Sys(12), Sys(1269), Sys(1270), Sys(1271), Sys(1272), Sys(13), Sys(14), Sys(15), Sys(1500), Sys(16), Sys(17), Sys(18), Sys(2), Sys(20), Sys(2000), Sys(2001), Sys(2002), Sys(2003), Sys(2004), Sys(2005), Sys(2006), Sys(2007), Sys(2008), Sys(2009), Sys(2010), Sys(2011), Sys(2012), Sys(2013), Sys(2014), Sys(2015), Sys(2016), Sys(2017), Sys(2018), Sys(2019), Sys(2020), Sys(2021), Sys(2022), Sys(2023), Sys(2027), Sys(2029), Sys(2030), Sys(21), Sys(22), Sys(23), Sys(2300), Sys(2333), Sys(2334), Sys(2335), Sys(2336), Sys(2339), Sys(2340), Sys(24), Sys(2600), Sys(2800), Sys(2801), Sys(3), Sys(3004), Sys(3005), Sys(3006), Sys(3050), Sys(3051), Sys(3052), Sys(3053), Sys(3054), Sys(3055), Sys(3056), Sys(3095), Sys(3097), Sys(3098), Sys(4204), Sys(5), Sys(6), Sys(602), Sys(7), Sys(9), Sys(999)