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.
What vast additions to the conveniences and comforts of living might mankind have acquired, if the money spent in wars had been employed in works of public utility;
—Benjamin Franklin, 1783
With this edition of the Hacker’s Guide, we’ve accepted that the Internet is for real and included fewer items in the downloads than in previous versions. Our thinking is that most of you don’t want to download a ton of stuff you’re never going to use in order to get the one or two items you do want. Instead, in the “Resource File” section, we’ve given some idea of what’s out there and where to get it. The actual download is left as an exercise to the reader.
Please do note that the example code from this book is copyrighted, so if you use any of it in your applications, you need to properly credit it. (That’s as simple as leaving intact the copyright notices.)
From our perspective, the most valuable item available for download is the book itself: hackfox.chm. While that was certainly true for the VFP 6 edition, it’s ever so much more so now. In the VFP 7 edition of the book, we’ve chosen not to kill trees to print what we estimate would be about 1,000 pages of the Reference section. It’s available only as part of the HTML Help version of the book. (For more information on working with that version, see “How to Use This Help File” in “Front of the Book.”)
At various places in this book, we’ve mentioned a routine or a form being in the downloads. These items are divided into two categories: demos and utilities. On the whole the utilities are built better than the demos, since they are made to work in real-life conditions. The demos are more fragile and less robust, usually built just to demonstrate a particular code fragment.
The files are in a zip file named downloads.zip. Download and unzip this file in the folder of your choice.
For the most part, these are samples provided to make it easier to test a particular class or to understand how something works. If you want to incorporate demo code into an application, you’ll probably want to add bulletproofing. Nearly all of these are taken directly out of the book. If there are other examples you want to test out, find that section in the included HTML Help and copy the text into the FoxPro editor.
AscChr.PRG—a form class in code that displays an ASCII chart and lets you set the font. Too slow to use in an application.
Coupon.PRG—run the coupon collector’s test for randomness.
DragDropSample.SCX—a form to demonstrate OLE drag and drop.
Dragger.SCX—a form to demonstrate the various native drag-and-drop features of VFP.
Forms.VCX—a form class for demo forms. (Used for DragDropSample.SCX.)
NewFoxCode.DBF—an IntelliSense script. See NewFoxCode.TXT for instructions on installing it.
PeekFKY.PRG—demonstration of reading a macro file with low-level file functions.
RandTest.PRG—run the Chi-Squared test for randomness.
Resize.PRG—a simple demonstration of how a form’s contents can be made to sensibly resize.
TestCat.SCX, CallCat.Prg—a form and a program to call it to demonstrate the CatMover class in CoolStuf.VCX. These use ITEMS.DBF and CATEGORY.DBF from the sample database provided with VFP.
TestDate.SCX—a form to demonstrate the DateSpin class in CoolStuf.VCX
TestDraw.SCX—a form to experiment with the interaction of DrawMode, FillStyle and their friends.
TestFont.SCX—a form to let you see the various fonts installed
on your system. (Use GETFONT()
in an app.)
Thrmdemo.SCX—a demonstration of the Thrmomtr class below.
These are routines or classes you can use in your apps.
AColCopy.PRG—copies one or more columns of an array.
AColScan.PRG—searches for an item in a particular column of an array. No longer needed in VFP 7, but handy in older versions.
AIndexes.PRG—fills an array with information about all
indexes of a table. Superseded by ATAGINFO()
in VFP 7 (we like to think we know
where they got the idea), but useful for older versions.
AProgram.PRG—fills an array with the program calling chain.
Another one you don’t need anymore in VFP 7 (where ASTACKINFO()
does this), but
may want to use in previous versions.
ARelns.PRG—fills an array with information about all relations in which a table is the parent.
Connect.VCX—a Connection Manager class. See Connect.Txt for details.
CoolStuf.VCX—contains several input tools. See CoolStuf.Txt for details.
DiffDate.PRG—returns the difference in days between two dates.
DispFkey.PRG—displays a list of available function keys.
MakeMArr.PRG—fills an array with the names of all the system menu items.
ParsColr.PRG—lets the user choose a color, and then parses it into red, green and blue. This code uses VFP 7’s ability to return an array from a method. For the same functionality in earlier versions, use the RGBComp function in FoxTools.
ParsFont.PRG—lets the user choose a font, and then parses it into name, size and style.
ShowMe.PRG—displays the type and value of nearly anything in a wait window.
Thrmomtr.VCX—a thermometer control and its component parts. See Thrmomtr.Txt
As we said in “How to Use this Book,” the reaction to the HTML Help version of the Hacker’s Guide was tremendous, so much so that we now view it as the primary version of this book. So, the most important thing you can download is the HTML Help version of this book.
That version differs from the printed version in a number of ways. Most importantly, we’ve chosen to publish the Reference section of the book only in the electronic version. In addition, this section in the HTML Help version contains a complete list of all the files available for download. (That gave us the opportunity to keep adding things until the last possible moment.)
The downloads also include a file called ViewHlp.CHM, which is the Help file for HTML Help. (You’ll also find some clues to working with HTML Help in “How to Use this Help File.”)
Finally, the downloads include an assortment of sample code. For the complete list, see this chapter in the HTML Help version.