Not too long ago, I wrote a program that cycled through all of VFP’s errors by error number. See, we have several new errors for VFP 9 and we’re also making some existing error messages more enumerative, for example, Error 15 (Not a table) will now tell you what is not a table.
Anyhow, my speedy little error raising program kept barfing somewhare in the 1000’s. I tried ON ERROR, TRY CATCH….nothing worked. It’d get to a point and >pow< … Do Cancelled. After writing a logging function to figure out what exactly was causing the issue, I traced it to Error 1116.
Error 1116, as paleovulpists (people who use old versions of Fox, and, yes, I made up the word) may recall is the “Too many windows open“ error, which was a common enough sighting in the Foundation READ days. These days, I can’t imagine how you’d actually get that error in the real world.
If you raise ERROR 1116 anywhere in code, you’ll get the error dialog with a single OK button. Once you click that button, the current application is cancelled. There’s no trapping this behavior and no way out.
I can’t grok a real world use for this behavior, but, if you ever want to cleanly cancel your application, ERROR 1116. Works every time.