# Monday, August 15, 2005

Most of what I'm about to show is more oddity than useful. There are a number of undocumented functions, commands, and other oddities (remember the mousewheel event being used to create a workable systray class?) in Visual FoxPro. From time to time developers will run into them while testing, or someone on the MS Fox Team will mention them, or Visual FoxPro enthusiasts will go looking for them.

Here are some odd Sys() functions that appear to be undocumented. I've included the nValue as well as the eValue where applicable. So for..

988: evalue .T. or .F. returned previous setting

...I'm saying that you can either run ?SYS(988, .T.), or ?SYS(988, .F.) and that the return value will be whatever you sent as a parameter the last time. I hope that makes sense, if not, then just try a few out and I think what I'm posting will be more understandable.

I realize that I didn't organize this list very well, but I'm in a hurry and just wanted to throw this in a quick blog entry (sorry organization and a sorry excuse - what can I say?).  Whether any of these SYS() functions do anything useful I don't know -- definitely SYS(1079, 0) is not useful -- handle that one with care.

Just so you know, the criteria I used to decide whether a SYS() function did something undocumented was if it was checking the type of the eValue (parameter sent in) and/or returned a value when called.  I feel that the SYS(999) and SYS(2901) are pretty interesting (I've included some code so you can explore them) and some of the SYS() functions that returned numeric values intrigued me as well. I tried to figure out what those numeric values were pointing to, but was unable to decipher them. I feel that perhaps they are handles or pointers of some kind.  Anyone with any additional information, feel free to chime in (Calvin?).

Lastly, I recall seeing a list like this years ago. I thought Steven Black had compiled it, but for the life of me I couldn't find it on the net. So, if anyone knows where that list is, I'd appreciate it if you would comment with the link to it. Thanks.

Here's my compiled list...

988: evalue .T. or .F. returned previous setting
989: evalue 0 or 1 Returned previous setting
999: evalue 1-4417 (accepts up to 4999 without error) brought up windows

***************************************
*!* Program to show some example windows from 2901
*!* Press tab to move to next window
SYS(999, 26)
SYS(999, 500)
SYS(999, 2999)
SYS(999, 4417)
***************************************

1004: returned 10105192 (increments?)
1005: returned 1220846 (increments?)
1006: returned 1218880 (increments?)
1011: returned 1967 (different at times)
1012: returned 5901
1013: returned 1063636632 (changes depending on a number sent in, otherwise same)
1017: returned 11163028 (changes but same after being called... don't know what changes it though)
1018: returned "Hold Index Lock during TableUpdate: On"
1021: evalue 0-65535 returned nothing
1029: evalue 0-65535 returned nothing
1039: evalue 0 to non-zero returned previous setting "ON" or "OFF" (zero was considered off)
1079: C5 error everytime takes numeric parameter
1101: returned 358875136
1102: returned 1609982
1103: returned 364798
1105: returned 365622 (different depending on window it is run from)
2050: evalue 0-10 returned parameter sent in
2400: evalue 0-1 returned 0 when 0 or nothing was sent in otherwise blank
2701: returned "{1:0, t:0, w:0, h:0}"
2901: evalue 0-9727 returned VFP string table && there is more further up, but I stopped at 9727

***************************************
*!* Program to show strings for 2901
*!* The following parameters will cause buffer overflow errors that shut Visual FoxPro down
*!* So we'll avoid them
ALINES(aryBufferOverflow, "604,801,802,835,2483,2489,2511,2533,2538,2556,2792,2811," + ;
   "2832,2845,2961,2975,2985,2987,2988,3039,3120,3407,3433,3478,3516,3517," + ;
   "3527,3532,3541,3546,3549,3550,4416,4673,4720,4795,4799,4812,4834,4882,4884," + ;
   "4891,4979,4999,5005,5015,5098,5103,5571,5601,5882,6584,7427,7433,7434," + ;
   "7437,7467,7482,7489,7493,7498,7511,7537,7551,7567,7578,7631,7634,7636," + ;
   "7653,7662,7673,7675", 1, ",")
IF FILE("C:\VFPSys2901.txt")
 ERASE("C:\VFPSys2901Strings.txt")
ENDIF
FOR lnCounter = 0 TO 9727
 WAIT WINDOW "One moment...  " + PADL(TRANSFORM(INT(lncounter / 9727 * 100)) + "%", 4, " ") NOWAIT
 IF ASCAN(aryBufferOverflow, TRANSFORM(lnCounter)) = 0
*!*   ?lnCounter
  =STRTOFILE("SYS(2901, " + TRANSFORM(lnCounter) + ") = " + SYS(2901, lnCounter) + CHR(13), "C:\VFPSys2901Strings.txt", 1)
 ENDIF
ENDFOR

IF FILE("C:\VFPSys2901.txt")
 MODIFY FILE ("C:\VFPSys2901Strings.txt")
ENDIF
*****************************************

3090: evalue 0 or 1 Returned previous setting
3100: evalue accepts positive integers returns nothing
4000: to 4004 will error with "feature is not available"
4010: will error with "feature is not available"
4015: evalue accepts anything returns 0
>4015: reutrns nothing, I checked up to 100,000,000
-1: and below work same as sys(0)

Monday, August 15, 2005 4:01:29 AM (GMT Daylight Time, UTC+01:00)  #    Comments [4]
Monday, August 15, 2005 6:07:29 AM (GMT Daylight Time, UTC+01:00)
OK, it was Bill Anderson that wrote the articles where I first read about undocumented Sys functions. I've found it in the June and July 2000 copies of the LA Fox Developer Newsletter. Here are the links (I couldn't find the third part of this series, if there ever was one):

http://www.lafox.org/newsletter/archives/2000/June2000_dir/June2000_s.htm

http://www.lafox.org/newsletter/archives/2000/July2000_dir/July2000_s3.htm
Monday, August 15, 2005 4:52:14 PM (GMT Daylight Time, UTC+01:00)
Hi Craig.

We discussed these undocumented SYS() functions in the Hacker's Guide to VFP 7.
Some of them we figured out, others not. Here are the ones we decided were meant for the VFP team for internal 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.

Doug
Monday, August 15, 2005 8:39:44 PM (GMT Daylight Time, UTC+01:00)
>>We discussed these undocumented SYS() functions in the Hacker's Guide to VFP 7.

Hi Doug,

I can't believe I didn't go look in my copy Hackfox when I was trying to figure these out. Thank you for stopping by and adding this informative comment. And, while I have you on the line... Awesome job on the screencast you did some time ago detailing the new reporting features (specifically the Report Listener) in Visual FoxPro 9.0. I point anyone who wants more information on the Report Listener to that video. I also noticed that some of your ideas heavily influenced the demo features Ken Levy showed off on the C9 video. Keep up the great work, it is very much appreciated at this end.
Wednesday, June 14, 2006 9:09:57 PM (GMT Daylight Time, UTC+01:00)

Craig,

For a list of undocumented functions in Fox/VFP (including other undocumented SYS functions), check out http://fox.wikis.com/wc.dll?Wiki~CategoryUndocumentedVFPFunctions

Bill Anderson
Bill Anderson
All comments require the approval of the site owner before being displayed.
Name
E-mail
(will show your gravatar icon)
Home page

Comment (Some html is allowed: a@href@title, b, blockquote@cite, em, i, strike, strong, sub, sup, u) where the @ means "attribute." For example, you can use <a href="" title=""> or <blockquote cite="Scott">.  

Enter the code shown (prevents robots):

Live Comment Preview

 

Archive

<February 2012>
SunMonTueWedThuFriSat
2930311234
567891011
12131415161718
19202122232425
26272829123
45678910