====================================== FoxPro Developers Network of San Diego ====================================== FoxDev TipsLetter #02-04 4 April, 2002 Website: Editor: ---------------------------------------------------------------------- CONTENTS: * Calendar * Tech Tips: File Handles for DOS Apps Dan Covill APP vs EXE Chuck Urwiler Creating Parameter Objects Dan Covill HTML Help in VFP7 * Links: Where Can I Find...? * Other Stuff: Time Warner Dumps AOL E-Mail Dan Covill Steve Weeks is Available * Administrivia ** Note address changes (courtesy COX@Home) ====================================================================== CALENDAR: *** NOTE SPECIAL DATE *** Thurs - April 11 - Doug Hennig ------------------------------- This presentation will discuss what it takes to generate a CHM file and how to automate the generation of HTML from Word documents. Word adds a lot of unnecessary things in an HTML file, and Doug will show how to strip that out. He'll show how to generate the various files required by the HTML Help Workshop, and finally, how to crank out the CHM file. NOTE: Doug will also be speaking on the 10th at OC Fox (www.ocfox.org) on "Scripting Your Applications For Maximum Flexibility." *** Another Special Date: Thurs - May 16 - Drew Speedie ----------------------------- Tips and Trick with VFP *** What happened to Wednesday? Thurs - June 13 - Mike Stewart ------------------------------ Microsoft's Mike Stewart will be presenting his topic on software testing. For those of you who were at the San Diego Devcon, he did this presentation there. *** Not quite so Special Date: Wed - July 10 - Victor Campos ------------------------------ Business Objects in VFP: A lot of speakers tend to present this topic with examples pulled from their framework - unfortunately, in order to utilize the examples and learn from them you have to buy the framework. Victor's presentation is put together with code that is not part of any framework and therefore can be put into practice directly, or may be used to learn from. It's not any code to begin building enterprise applications, but, it's a perfect way to get started on the learning curve that many VFP Developers are still struggling with. *** Standard Special Date: Thus - August 15 - Mike Feltman -------------------------------- Visual Fox Express ------------------------------- Escondido meetings are at Bergelectric, 2222 Meyers Avenue. All meetings are at 6:30 pm. Take the Nordahl exit from Highway 78 (west of I-15). Head South, cross Mission at the lights. Next right onto Meyers Ave. Berg Electric is a one-story building on the right, just before Oper Street (there's no sign). ====================================================================== TIPS ====================================================================== FILE HANDLES FOR DOS APPS by Dan Covill Most of us have learned that running a FoxPro DOS app requires a "files=100" (or 200, or something) statement in config.sys. (The default is something like 30, which generally causes a "Too many files open" error.) When a DOS app is run under Windows, we still need that "files=100", but each version of Windows puts it in a different place. Also, users have a tendency to "upgrade" Windows versions without warning. Windows 9x: Add "files=100" to the Config.Sys file, same as in DOS. Windows NT/2000/XP: Add "files=100" to the \WINNT\SYSTEM32\Config.NT file. Windows Me: Me is a mongrel - it's like W9x, but it ignores the config.sys file. You have to add the following line to the [386enh] section of the System.ini file: perVMFiles=100 Dan Covill Middleton Consulting dcovill@san.rr.com ---------------------------------------------------------------------- APP vs EXE by Chuck Urwiler [As you've probably noticed, building an App or an Exe takes almost exactly the same time, and the results are pretty much the same size. And they look the same running. So what's the real difference? Chuck Urwiler explained it in this ProFox post. DC] The difference between APP and EXE is whether a process is created or not. Each new process will require another instance of the VFP runtime in memory; therefore, it's more efficient to have one EXE and many APPs than multiple EXEs. Gotchas? Well, you already know that an APP can't be run by itself, it has to be run from within a VFP EXE. Also, the separate EXEs will have their own thread of execution, but you really can't take advantage of that if you are launching the EXEs from within a loader EXE anyway. Oh, another one: APPs do not have the version information in them, that's accessible via the AGetFileVersion function. So if you're using that now, you'll have to resort to file dates for "versioning" instead of the internal numbers. Chuck Urwiler, MCT, MCSD, MCDBA http://www.eps-software.com ---------------------------------------------------------------------- CREATING PARAMETER OBJECTS by Dan Covill We all know that having too many parameters to a procedure or a function is a real drag - who can remember all the types or what order they come in? Objects give us a VFP equivalent of the C language "structure"; a way to collect a heterogeneous set of properties into one neat package. It's perfect for returning option settings from a dialog form - set the defaults into a parameter object and update them in the form. But how do you build these parameter objects, and where do you keep them? Do you have to have a separate one for every form, and do they have to clutter up a Vcx somewhere? No, they don't. Example 1: ---------- It's easy to build parameter objects "on the fly", in code. Here's a simple example: oParm = createobject("Separator") with oParm .AddProperty("LastName", "Covill") .AddProperty("Age", 99) endwith do form DataForm with oParm I use Separator instead of Custom because it has a much smaller footprint - less built-in properties and methods. Create a Custom and a Separator, do a List Objects, and see what I mean. Example 2 - AutoCreating: ------------------------- Ed Leafe has used the VFP6 This_Access method to get rid of the necessity for typing all those .AddProperty() calls. His improvement auto-creates any property that isn't there. DEFINE CLASS ParmObj AS Separator lAutoCreate = .T. && so we can turn it off *-- This_Access is a built-in method that is called on any access *-- to any property of the object. New in VFP 6. FUNCTION This_Access LPARAMETERS tcProp IF lAutoCreate AND NOT pemstatus(this, tcProp, 5) *-- No such property, so add it this.AddProperty(tcProp) ENDIF RETURN this ENDFUNC ENDDEFINE You can save this code in your procedure library Prg. Now all we have to do is this: oParm = createobject("ParmObj") with oParm .LastName = "Covill" .Age = 99 .IQ = -5 endwith Nice and clean, and all the properties get auto-created by magic! WARNING: For some reason, the with/endwith works only in VFP7. In VFP6, you have to do oParm.LastName = "Covill" etc. NOTE: Ed sets .lAutoCreate to .F. in the Init() of his forms to help catch mis-spelled properties during development. Example 3 - Arrays: ------------------- What if you need an array as a parameter? No problem, but there are three ways to do it. a. Example 1 code: You have to dimension the array in AddProperty(). You can also re-dimension it later, so long as you created it as an array. oParm = createobject("Separator") with oParm .AddProperty("LastName", "Covill") .AddProperty("aProp[2]" .aProp[1] = 99 .aProp[2] = -5 endwith b. Example 2 code: The This_Access() method will not deal with an array. You still have to use AddProperty(). oParm = createobject("ParmObj") with oParm .LastName = "Covill" .AddProperty("aProp[2]") .aProp[1] = 99 .aProp[2] = -5 endwith Not really a problem, but it breaks the rhythm a little. c. The Final Solution! Reidar Sjoen suggested that a simple change to Ed's code would create _all_ properties as arrays! This has no effect on the scalar properties, because using "PropName" is the same as using "PropName[1]". However, they can now be re-dimensioned into true arrays when needed. FUNCTION This_Access LPARAMETERS tcProp IF lAutoCreate AND NOT pemstatus(this, tcProp, 5) *-- No such property, so add it as an array this.AddProperty(tcProp+'[1]') ENDIF RETURN this ENDFUNC And now we can do this: oParm = createobject("ParmObj") with oParm .LastName = "Covill" dimension .aProp[2] .aProp[1] = 99 .aProp[2] = -5 endwith d. Another Final Solution: Chad Bourque pointed out that since you now have a ParmObj class, you can also define an AddArray() method and do whatever you want, including dimensions and even filling in the values. Note that you can always use the AddProperty() method to create an array. Whether version (c) is worth while or not depends on whether you will use it enough to remember it! Dan Covill Middleton Consulting Inc. (858)272-2448 ---------------------------------------------------------------------- HTML HELP IN VFP 7 Dan Covill The following excerpt is from Knowledge Base document Q314296. SYMPTOMS After a Visual FoxPro (VFP) 7.0 application is distributed to a computer that does not have VFP 7.0 installed, HTML Help files do not open when accessed from inside the application. CAUSE The files FoxHHelp7.exe and FoxHHelpPS7.dll are required in order for HTML Help to work from a distributed VFP 7.0 application. RESOLUTION If you are using "InstallShield Express - Visual FoxPro Limited Edition" to install your application, add FoxHHelp7.exe and FoxHHelpPS7.dll in step 2 of the install project. These files should be installed on the development computer in the \Program Files\Common Files\Microsoft Shared\VFP folder. If you do not want to keep them with your application files, you can place them in [CommonFilesFolder]\Microsoft Shared\VFP. If you are copying the files manually, after bringing them over you need to run the command FoxHHelp7 /regserver on the new computer to put the proper entries in the registry. ====================================================================== LINKS ====================================================================== This is a (semi) permanent list of places to look for technical help when you get blind-sided by the latest urgent requirement. We don't give specific URLs for MSDN articles because (a) they're too long and (b) they change too often! ------------------------------- MSDN ON LINE: There's a ton of stuff here, look at the Magazines tab, and read some of the regular columns. MSDN Library Look in Technical Articles | Visual Studio | Visual FoxPro MSDN Library: "Building Three-Tier Client/Server Applications with Visual FoxPro" ADO MSDN Library: ADO Jumpstart for Microsoft Visual FoxPro Developers John V. Petersen, April 1999 DNA (Distributed interNet Architecture): MSDN On-line: "Top Windows DNA Performance Mistakes and How to Prevent Them" FoxPro 2.6: http://members.aol.com/FoxProResources/fpfp.htm MTS: Microsoft Transaction Server MSDN Library: "Microsoft Transaction Server for Visual FoxPro Developers" ODBC: MSDN Library: "Using Visual FoxPro to Access Remote Data" ODBC drivers are part of MDAC - Microsoft Data Access Components - and are available for download at: "www.microsoft.com/data" VS Installer: MSDN Library: a. "Using Visual Studio Installer for VFP 6.0 Applications" b. "VFP 6.0 and VS Installer Tutorial" VFP Publications: www.advisor.com FoxPro Advisor www.pinpub.com FoxTalk magazine www.hentzenwerke.com Hentzen Publishing (Books, discussion, and downloads) VFP General: MS Developer Applications Forum on Compuserve http://go.compuserve.com/msdevapps The History of FoxPro (submitted by Steve Settimi) www.foxprohistory.org The Universal Thread http://www.universalthread.com The "Wiki" www.wikis.com fox.wikis.com fox.wikis.com/wc.dll?Wiki~FoxForumWiki Here is the most complete set of FoxPro links you're likely to find: http://www.cetus-links.org/oo_visual_foxpro.html Private websites with useful free info and downloads: www.prolib.de/foxlinks.afp (wOOdy Wondzinski) www.honeypass.com (Allen Pollard) www.ukfug.org.uk British user group www.lafox.org LA user group www.pinter.com/ Les Pinter www.vfug.org/ Virtual Fox User Group www.leafe.com Ed Leave, ProFox listserve www.jamesbooth.com www.foxforum.com www.foxfolk.com www.stevenblack.com www.craigberntson.com WEB Development: www.foxcentral.net Joint effort by Microsoft, West-Wind, and the Universal Thread Lots of news and development info. These products all work well with VFP. AFP www.afpweb.com and www.afpages.com DotFox www.elsoftware.com FoxWeb www.foxweb.com Web Connection www.west-wind.com X-WORKS www.x-works.com Windows General Win32 API (with VFP examples) XML - What's New in XML for Microsoft Windows 2000 See also OLE DB drivers for XML in MDAC 2.6 at "microsoft.com/data" [Contributions solicited. DC] ====================================================================== OTHER STUFF ====================================================================== TIME WARNER DUMPS AOL E-MAIL The Wall Street Journal reported last week that Time Warner has stopped requiring that its divisions use a form of AOL e-mail, citing continuing problems and complaints from management. "Among the problems cited: The e-mail software frequently crashed, staffers weren't able to send messages with large attachments, they were often kicked offline without warning, and if they tried to send messages to large groups of users they were labeled as spammers and locked out of the system." "In late January, executives at Warner Music tried to alert employees to problems with the new system. "2% of e-mail is being lost," the internal e-mail read. "If you are expecting critical e-mail, you may want to follow up with the sender." Read the whole heart-warming story at: http://www.msnbc.com/news/727898.asp?cp1=1 ---------------------------------------------------------------------- STEVE WEEKS IS AVAILABLE from ProFox [Steven Weeks is a member of ProFox who lives (in his own words) "at the arse end of Ireland". He contributed the following post last week. Not only are his topics timely, his signature block is a model for us all. DC] I am available, for a small consideration, to give lectures on the following topics : VFP - What the hell is it...no, im asking you ? Frameworks...far too complicated...dont bother. Good coding practices and why I dont use them. OOP...I did it again. How I gave up the demon drink..sorry wrong meeting. How to bluff your way through a software project. Active X controls...how to make them INactive. SQL...what does it mean (Sorta' Queer Looking) Steve ****************************************************************** This email represents the opinions and beliefs of the sender and not that of any other sane rational human being. The sender is a cabbage with little or no intellect therefore we advise you to disregard this email as it most likely to be inane drivel. We very much doubt this pathetic excuse for a man has virus checked this email, it is highly unlikely he even grasps the fundamental reason for virus checking.To illustrate the depths of stupidity to which this individual will plummet, we are in posession of evidence that he tries to stick postage stamps on his emails. ****************************************************************** --------------------------Administrivia------------------------------- This newsletter is a service to all FoxPro developers, provided without charge by the FoxPro Developers Network of San Diego (FPDN). Anyone may subscribe (or unsubscribe) at our web site . The link is on the home page. The Resources button on the website will take you to the back issues of the newsletter. The editor (Dan Covill) is solely responsible for the content. E-mail him with YOUR tips, comments, or complaints. Editor: Dan Covill 858-272-2448 dcovill@acm.org Board of Directors: Eric Lendvai - President 760-734-4929 eric@elsoftware.com Art Bergquist - Vice Pres 760-740-0428 abergquist@sbcglobal.net Claude Nikula - Secretary 619-615-6318 crndev@cox.net Barbara Peisch - Treasurer 760-729-9607 barbara@peisch.com Dan Covill - Director 858-272-2448 dcovill@acm.org Thad V'Soske - Director 619-544-9900 tvsoske@hanoverdirect.com ----------------------------------------------------------------------