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.

Sys(999)

This is one of the most intriguing hidden functions we’ve encountered. It lets you display all the internal VFP dialogs, either sequentially or individually. (Our thanks to EXE hacker extraordinaire Bill Anderson for pointing it out to us.)

Usage

SYS( 999, nResourceNumber )

Each time you call SYS(999), it displays one of the built-in VFP dialogs. But the dialog isn’t usable in this way. Instead, it’s simply painted on the screen to allow you to check it over. In some cases, you see something like “DLParamText 0” where text would normally appear. In other cases, large areas are blank.

You can pass a particular dialog number (and no, they’re not documented anywhere, but they don’t need to be) to display that dialog. Once you see a dialog, you can press Enter, Escape or Cancel to get out of it, or use the up and down arrow keys to cycle to the next dialog (the cycle doesn’t wrap between the first and the last dialog; it just keeps re-displaying). No matter what you do, the dialogs don’t actually do anything to your working environment—they’re just displayed. If NOTIFY is on, the resource number is echoed to the status bar in the form “Dialog resource number nnn.”

So, what’s the point? This function is actually a tool for the VFP testing team to allow them to run through all the internal dialogs and check for problems like spelling mistakes or controls that don’t align correctly. Even more importantly, the team can use the function when testing non-English versions to make sure that every single text string that appears in a dialog has been translated to the appropriate language.

We can’t think of any reason why you’d actually need to use this function, but it is fascinating to cycle through the dialogs. We were amazed how many there really are.

One final note. There are lots of unused dialog numbers. If there’s no dialog with the number you pass, VFP shows the next one up. That means that if you write code to loop through all of them (the last one used in VFP 7 is 4414), you’ll see some dialogs many times. In fact, there’s a huge gap between 698 and 4095.

Example

SYS(999, 442) && Displays the VFP "About" screen

See Also

Set Notify, Sys() Functions