====================================== FoxPro Developers Network of San Diego ====================================== FoxDev TipsLetter #02-12 2 December, 2002 Website: Editor: ---------------------------------------------------------------------- CONTENTS: * Calendar (many changes!) * Editor's Note * FPDN News * Tech Tips: VFP Security Hole Barbara Peisch Generating GUIDs Steve Settimi Using FTP from FoxPro ProFox An Alternative to InstallShield ProFox Where Do Biz Classes Go? Ed Leafe * Other Stuff: .NET Awards Selling VFP vs VB Les Pinter Job Requirements Steve Settimi Travels with .NET Charlie Coleman * Knowledge Base Updates New/Updated KB articles on VFP * Links: Where Can I Find...? * Administrivia ====================================================================== CALENDAR: *** PLEASE NOTE! *** Our holiday party, which was originally scheduled for Dec 12 has been moved to Dec 17 due to some scheduling conflicts that have come up. Tue - Dec 17 - HOLIDAY PARTY ----------------------------- Our treasury is significantly lower this year due to the expenses of bringing in all the top-notch speakers this year. As a result, the group will not be paying for a holiday party this year, however, we expect to have a group sponsored bar-be-que next summer. This year, our holiday party is scheduled for December 17 at 6:30 at the Old Spaghetti Factory in San Marcos. The Spaghetti Factory is at 111 N. Twin Oaks Valley Rd. There's a Twin Oaks Valley Rd. exit off of route 78. After you exit, head north. Thu - January 9 - John Gunvaldson - Sizzler in Murphy Canyon ------------------------------------------------------ John will be showing us how to use the ProMatrix framework. John started using ProMatrix DOS/WINDOWS version back in 1994 for NavSea HQ in Washington DC. He's been on just about every Beta of ProMatrix since then (all through the conversions to VFP 3, 5, 6 and 7). Thu - Feb 13 - Steve Settimi - Sizzler in Murphy Canyon ------------------------------------------------------- The demo will cover the in's and out's of the VFP 7.0 Database container (DBC) We'll briefly explore the vast realm of the 58 DBC Events, focusing on a few, and how/when/where to use them for different purposes. We'll look at each object of the DBC (1) table, (2) connection , (3) views , and (4) stored proceudures using DBSETPROP() and DBGETPROP() functions against each object type. We'll see the use of program file for DBC events and stored procedures. I'll demonstrate how to use the DBC effectively in building forms [assigning classes to fields]. Things to keep in mind with field level rules, record level validation and table triggers (insert, update, delete). We won't be looking at the Upsizing Wizard ----------------------------- All meetings start at 6:30 pm. Sizzler Meetings: Back room of Murphy Canyon Sizzler: 3755 Murphy Canyon Rd Take I-15 to the Aero Dr exit (South of Balboa) Head West to first traffic light West of freeway Turn Right Sizzler is on the right almost immediately Buy your dinner at Sizzler and we'll have our Q&A session while we eat. PLEASE TRY TO COME EARLY ENOUGH TO ORDER YOUR DINNER BEFORE 6:30! Escondido Meetings: Training room of Bergelectric 2222 Meyers Rd. - Take highway 78 to Nordahl (Just west of I-15) - Go south past Mission - Turn right on Meyers (first right past Mission) - The building is on the right just before Oper Street. ====================================================================== EDITOR'S NOTE Finally, a newsletter! For those of you who keep track, the last one was #9, which actually arrived at on September 29th. If you'd like to see more frequent newsletters, one way to help that along would be to send me something to put in it! Dan Covill ====================================================================== FPDN NEWS 1. Meeting Schedule At the October meeting the Board voted to move the meeting date to the second Thursday of the month, in order to avoid having to change it for guest speakers. The second Thursday fits in with LA and Orange County for speakers making what has become the "Southern California Tour." It is also a better date for Sizzler's. 2. Meeting Place Our standard meeting place is now Sizzler's, on Murphy Canyon road just off Aero Drive (which is in turn just off I-15). Please help by coming, so we can meet our attendance minimum and continue to meet there! 3. Programs The Board is a little concerned that the flood of celebrity guests was shutting out the chance for our own members to speak. So we will be attempting to schedule a short mini-presentation by a member before the main speaker. If you've done something you'd like to show us, talk to a Board member and get on the schedule. 5. Election There was a real election held at the November meeting, there being seven candidates for six positions. The results: Lou Syracuse is a new director, and yours truly is out. Vox populi! (I missed the meeting due to an outburst of senility - I thought it was the second Thursday, since we had just voted to move the dates. With our usual consistency, the first meeting under the new policy was an exception! Oh well, if you snooze you lose.) Welcome and congratulations to Lou. Dan Covill ====================================================================== TECH TIPS ====================================================================== VFP SECURITY HOLE SQL Server FoxPro ODBC driver OpenDataSource() buffer overflow Description: Microsoft SQL Server 2000, Microsoft Desktop Engine (MSDE) 2000, Microsoft SQL Server 7.0, and Microsoft Data Engine (MSDE) 1.0 are vulnerable to a buffer overflow in the OpenDataSource() function in the Microsoft Visual FoxPro ODBC driver. By creating a SQL query that passes an overly long SourceDB parameter to the OpenDataSource() function when connecting to a FoxPro database, a remote attacker could overflow a buffer and execute commands on the system with SYSTEM level privileges. Platforms Affected: Microsoft MSDE 1.0 Microsoft MSDE 2000 Microsoft SQL Server 2000 Microsoft SQL Server 7.0 Remedy: Apply the appropriate patch for your system, as listed in Microsoft Security Bulletin MS02-056. See References. References: SCAN Associates Advisory, "FoxPro ODBC Driver Buffer Overflow" at http://www.scan-associates.net/papers/foxpro.txt Microsoft Security Bulletin MS02-056, "Cumulative Patch for SQL Server (Q316333)" at http://www.microsoft.com/technet/treeview/default.asp?url=/ technet/security/bulletin/MS02-056.asp submitted by Barbara Peisch ---------------------------------------------------------------------- GENERATING GUIDS Stephen Settimi Here's a new nifty-thrifty tip I found while trying all sorts of convoluted coding to get a GUID from the API registry. With this little jimmy, you don't have to code at all. oGUID= createobject("scriptlet.typelib") ? oGUID.GUID Every time you instantiate the object it carries a new GUID value! Stephen Settimi, GNS Information Technologies, Inc. ---------------------------------------------------------------------- USING FPT FROM FOXPRO "Bill" on ProFox This is a dated (1999) note from when I last used this approach, but I think it still works. To use FTP from a program, create a command file and call FTP using RUN and passing it the file name. 1. Put commands in a file (e.g. FTPCMDS.TXT) open my.domain.name (or IP addr) myuserid mypassword put myfile.txt bye 2. Issue command: RUN FTP -S:FTPCMDS.TXT To get FTP help (list of commands supported), enter FTP -S:dasf (junk name) or FTP and then enter ? to the FTP prompt (2 diff helps). A slicker way is to use the Internet Transfer Control, which avoids using RUN. Bill ---------------------------------------------------------------------- AN ALTERNATIVE TO INSTALLSHIELD Jim Kearns via ProFox You see, these days there has been a rather lenghthy thread on the UniversalThread on the Install Shield Express weaknesses and known and admitted bugs. The thread mentions that we have to purchase the IS upgrade, at over US$ 250. My question is also directed to the Microsoft Authorities: why would you sell us a VFP package, for which you issue a service pack that fixes many problems, and not include a fix to the Install Shield installation bugs. If your reply, is what I already anticipate as being: "Install Shield is made by some other company, ask them", don't you think that it is your responsibility to give us a free fix, since you are including IS in the VFP7 sale price? So considering all of the above, is there a way out of InstallShield ? TIA Rafael Copquin Take a look Inno Setup form JR Software (www.jrsoftware.org). It will do everything that the full InstallShield package will do and best of all, it's free. Jim Kearns ---------------------------------------------------------------------- WHERE DO THE BIZ CLASSES GO? Ed Leafe via ProFox [A recent ProFox post asked for an explanation of the interaction between the "BizClass" (i.e., Business Class) and the RDBMS or Data Layer. Ed Leafe offered the following:] The interaction between the tiers usually follows the "chain of responsibility" design pattern. Briefly, this pattern requires that an object that receives a message know that it should handle the messages itself, or which object to pass the message to if it can't handle it. A good example is in the Codebook framework. There is a button on the common toolbar for "New": i.e., create a new record. When the user clicks on this toolbar button, what should happen? In a monolithic app, the Click() event of the toolbar should simply be APPEND BLANK, and we're done. But this poses several problems. Perhaps it isn't appropriate for a new record to be created (security, etc.). Perhaps there is no table selected. Perhaps there are no tables, period: the data is in a MySQL database or an XML document or whatever. Sure, you could code for all this in the toolbar button, but what happens when you need to create a new record in some other part of the app? You need to either duplicate all this code (and maintain both copies as things change), or you have to make sure that the toolbar exists, and call its New button's Click() code. Not a very smart design. With Chain of Responsibility, you recognize that a button's only job is to notify the app that the user clicked on it. That's it. Reacting to the request is not what buttons do; they simply pass along the message. In the case of Codebook, the toolbar checks if there is a _Screen.ActiveForm, and if so, passes the New() message to it. Forms are Interface objects. In Codebook, there is a class of forms that are designed to work with bizobjs. They know that when they get a request such as New(), they pass it on to their primary bizobj, and wait for a return value. If the value is an error code, it needs to display the error message; otherwise, it refreshes itself to display the new record's information. That's all the a form should do. No business logic is carried out, no database actions - just display stuff. The bizobj gets the New() message, and then carries out a series of tests to determine if such a request should be carried out or denied. If it determines that the user should not be creating a New record at this point, it returns the appropriate error code to whatever called it. Otherwise, if creating a New record is OK, it passes the request on to a DataBehavior object. This object's only job is to interact with the data backend, and report its successes and failures back. For a DBF-based app, the DataBehavior simply issues the APPEND BLANK, and returns a success code if the new record is created. When the bizobj gets the successful return code, it can then carry out some default actions for new records (create the PK, set default values, requery child bizobjs, etc.). It then passes the success/failure code back to the form, which can then react by displaying the new record or notifying the user of the problem. While this may seem like a lot of steps (toolbar -> form -> bizobj -> data object -> bizobj -> form), it clearly separates the responsibility for each part of the process, and makes maintaining the code for any part of the process much easier. It also allows adapting the app to different front ends (such as web apps instead of desktop) or different backends (any RDBMS, or XML, or any other data store), without having to re-write all of the business rules. Ed Leafe http://leafe.com/ http://foxcentral.net ====================================================================== OTHER STUFF ====================================================================== .NET AWARDS Here's a quote from Bill Gates, at the release of .NET on February 13, 2002: "Visual Studio .NET has won more awards before shipping than any other product." Huh? ---------------------------------------------------------------------- SELLING VFP VERSUS VB Les Pinter [Les Pinter in the latest VFUG newsletter:] VB.NET has helped me return to a successful consulting practise, so I want to share my secret with you. When I'm asked to bid on development work, I tell my prospect about VB.NET. I describe the huge (over 130,000 Properties, Events and Methods) wealth of the .NET environment. I describe Microsoft's massive advertising campaign, which ensures that .NET will be the software development environment of choice for years to come. I demonstrate the IDE and the wealth of tools built into the environment, including a pretty robust replacement for the SQL Server Enterprise Manager built right into the IDE. I calculate the number of tables, screens and reports, and I estimate of the amount of coding that will be required in VB.NET, and quote them a price. Then I let them know that I can do the job in a third the time in FoxPro, for a third the cost of the VB.NET version, and that it will run 10 times faster with no SQL Server license fees, and I get the job. ---------------------------------------------------------------------- JOB REQUIREMENTS Found this under "Required Skills" in a job description: "Extremely adept at operating at a high level of ambiguity..." Stephen Settimi ---------------------------------------------------------------------- TRAVELS WITH .NET Charlie Coleman via ProFox 1) purchase Visual Studio .Net 2) attend VB.Net training class for 2 weeks 3) Dump VB.Net and focus on C# 4) Drop C# and go back to VB v6 5) Download .Net Service Pack (xyz....) 6) Receive MVP award from MS for your outstanding performance 7) Play with Java for a while 8) Reinstall WinXP (got disabled when you plugged in your CD burner, external HD, and USB camera at same time) 9) Reinstall Visual Studio .Net 10) What was the question? -Charlie ====================================================================== VFP KNOWLEDGE BASE UPDATES ====================================================================== The following KB articles are new or updated, per KBAlertz.com [Note: Apparently KBAlertz split their Visual FoxPro category up, making separate categories for VFP 6.0 and VFP 7.0. So I didn't get any listings since 8/30. I went to their website and picked up the following long list. DC] VFP 6.0 - 9/25/02: 221742 FIX: C0000005 Fatal Error With Big Array Property 258736 FIX: Multi-Threaded DLL Is Slow to Release Connection Under MTS 258161 HOWTO: Read a DWORD From the Registry 257624 HOWTO: Clear Report TAG, TAG2, and EXPR Fields Using .pjx Hooks 276287 PRB: SET FORMAT File Scrolls to End of Table in Visual FoxPro 275863 PRB: View Designer Sets Decimal Places to 3 for Double Data Types 275515 PRB: Performance Degradation with SQL Selects from Offline Views 272338 HOWTO: Use Visual FoxPro and ADO Stream Object to Retrieve Binary Data 272219 PRB: Visual FoxPro App Installed with Visual Studio Installer Creates Foxuser Files on Desktop Q271819 HOWTO: Spell Check in Visual FoxPro with Microsoft Word Q269387 HOWTO: Obtain a GUID in Visual FoxPro Q269284 INFO: Undocumented Function SYS(1104) Q269021 PRB: Synergex Driver Displays Fields Incorrectly in View Designer Q268908 PRB: Error Message "Variable 'APP_CLASSNAME' Is Not Found" Q268847 PRB: Assign Method and Optimistic Buffering Makes GetFldState() = 2 Q266370 PRB: Controls that Use FoxFont are Unreadable on Arabic or Hebrew OS Q266363 BUG: Fatal Error When You Close Forms That Use DHTML Edit Control Q265880 FIX: Error Message: Summary Band is Too Large to Fit on Page Q265104 PRB: Document Jumps to Top When You Edit With an OleBoundControl Q163801 PRB: "Error Locating Config File-Bad Path?" in Visual FoxPro Q299341 FIX: Rounding Error When Saving Calculated Value into Integer Field Q299322 FIX: "Too Many Names Used" Error with Repeated AddObject()/RemoveObject() Calls Q295840 HOWTO: Determine if a Service Exists Using Visual FoxPro Q293293 PRB: Cannot Update Source Code Control Status From ProjectHook.Init() Q291535 HOWTO: Find Installed Modems with Visual FoxPro Q295840 HOWTO: Determine if a Service Exists Using Visual FoxPro Q281380 HOWTO: Print Multiple .tif Files from Visual FoxPro Q281898 BUG: Missing Integers with SQL Statement When You SET COLLATE TO "RUSSIAN" Q285221 PRB: "There is Not Enough Memory" Error with Menu in a Defined Window Q285396 HOWTO: Obtain Microsoft Office Constants from .OLB Files with Visual FoxPro Q286339 BUG: "Data Type Mismatch" Error After PACK When Used with an IDX File Q260337 HOWTO: Use the Sleep API to Pause Program Execution in a DLL Q260340 Visual FoxPro 6.0 Sample: Using a PictureClip Control to Animate in Visual FoxPro Q276554 INFO: How To Modify a Resize Object to Work with an OptionGroup Q277725 HOWTO: Copy Fields Containing NULL to Text File Q277900 PRB: Changes to Key Field in Parent Table Not Cascaded When Deleted Before Unlocking Record Q260237 Visual FoxPro 6.0 Sample: Demonstrates Using a PictureClip Control Q247356 HOWTO: Execute a SQL Server 7.0 DTS Package from Visual FoxPro Q247370 HOWTO: Pass Parameters to a SQL Server Stored Procedure Q247977 INFO: Updated FOXISAPI Available on the Web Q248116 HOWTO: Use the Session Class to Provide a Private Data Session Q260155 Visual FoxPro 6.0 Sample: How To Use Animation Control Q246609 HOWTO: Start Internet Explorer and Navigate to a URL Using OLE Automation Q246693 HOWTO: Get Document Statistics from Word via OLE Automation Q247036 HOWTO: Add Sound to Form Using the Microsoft Multimedia Control Q259933 HOWTO: Use an MSChart Control with Visual FoxPro Q246021 HOWTO: Close an Instance of Word from Visual FoxPro Using APIs Q326568 MS02-049: Flaw Might Allow Web Page to Start Visual FoxPro 6.0 Application Without Warning Q262038 PRB: COMRETURNERROR() Does Not Work if Errors Occur During Server Creation Q262067 BUG: RStoCursor in Vfpcom.dll File Does Not Work with Certain Data Types Q258737 FIX: DataSession Property Cannot Be Set in Session Subclass Q259669 PRB: _Include Variable Behavior with Modify Form/Class Q253785 PRB: Error When Setting DateTimePicker Control Programmatically Q253882 HOWTO: Use a DataGrid ActiveX Control in Visual FoxPro Q261237 Visual FoxPro 6.0 Sample: Selects a Printer by Using the Kodak Image Admin Control Q250501 HOWTO: Automate Word from Visual FoxPro and Add a Table to a Document Q250669 PRB: Wizard Causes "Variable Not Found" Error Messages When Adding Record Q251310 HOWTO: Exit Windows from Visual FoxPro Q260856 PRB: File Access Denied When Opening a Table Accessed by Using ADO Q253588 PRB: OLE Error with Empty or NULL ControlSource with Date and Time Picker Q260405 HOWTO: Import Table Structures and Data from Microsoft Access Q249700 PRB: Hot Keys of a ToolBar ActiveX Control are not Active Q249836 PRB: Table Buffer Contains Uncommitted Changes on REQUERY() Q257287 PRB: Rich Text Control 6.0 Displays Word Tables Incorrectly Q255790 HOWTO: Use a DataCombo ActiveX Control in Visual FoxPro Q257230 HOWTO: Display a Form in a Top-Level Form on Startup Q255744 HOWTO: Obtain a Device Context Handle for a Print Device Q156088 HOWTO: Hide Desktop in Run-Time (.exe) VFP5 Application Q255279 HOWTO: Create a COM DLL with Visual FoxPro that Prints Screen Image VFP 7.0 ------- Q318981 PRB: InstallShield Express Package Does Not Install on Windows XP if Target OS List Is Limited Q316964 INFO: How to Obtain the Latest Visual FoxPro for Windows 7.0 Service Pack Q314296 PRB: HTML Help Does Not Work from VFP Application How To Look Up These Articles: To get to a specific KB article: a. Go to support.microsoft.com. Search is at left of the page. b. Select "Visual FoxPro" on the drop-down. c. Enter the document number in the textbox below it. d. Click on the green arrow. To Subscribe: Subscribe at . You can specify any MS product to receive alerts on. ====================================================================== 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: msdn.microsoft.com/vfoxpro Microsoft's official VFP home page www.foxcentral.net Joint effort by Microsoft, West-Wind, and the Universal Thread Lots of news and development info. 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 Leafe, ProFox listserve www.jamesbooth.com www.foxforum.com www.foxfolk.com www.stevenblack.com www.craigberntson.com WEB Development: 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] --------------------------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 Thad V'Soske - Secretary 619-544-9900 tvsoske@hanoverdirect.com Barbara Peisch - Treasurer 760-729-9607 barbara@peisch.com Lou Syracuse - Director lsyracuse@delmardb.com Claude Nikula - Director 619-615-6318 crndev@cox.net ----------------------------------------------------------------------