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)