VFP Advanced: Is This The Next Visual FoxPro?

Transcription

VFP Advanced: Is This theNext Visual FoxPro?Eric SeljeSalty Dog Solutions, LLCMadison, WI USAVoice: 608-213-9567Website: www.SaltyDogLLC.comEmail: Eric@SaltyDogLLC.com

VFP Advanced: Is This the Next Visual FoxPro?Did you know there is (kind of) a Visual FoxPro version 10? VFP Advanced (VFPA) fixes over80 bugs in Visual FoxPro 9, introduces a couple of new features and data types, and also(drumroll, please) comes in a 64-bit version!In this session, we'll dive into this free patch for Visual FoxPro. We'll go over some (but not all81, as of this writing) bugs that it fixes, discuss what being 64-bit does for us, and have aconversation about whether you want to develop and release software that uses this patch. Is itdangerous? Buggy? Well-supported? Let’s find out Copyright 2019, Eric SeljePage 2 of 31

VFP Advanced: Is This the Next Visual FoxPro?What is VFP Advanced?Imagine there’s a group of employees at Microsoft. They are heartbroken when they hear“the announcement:” development on the Fox product line is ceasing. They know how greatVisual FoxPro is and see the potential for what it can be. These employees are also aware ofa few niggling bugs in the product and are determined to see them fixed and released totheir devoted user base. And they have access to the Visual FoxPro 9 source code.So, they go rogue. They start secretly releasing updates to Visual FoxPro 9 that fix over 80bugs they found. And then they add a few features too. And with some brilliant coding, theyeven release the oft-requested 64-bit version of Visual FoxPro 9 as well!Those releases are Visual FoxPro Advanced.But these releases aren’t from a team of people, it’s only one man, a Mr. Chuanbing Chenfrom Shenzen, China. And Chen does not nor never has worked for Microsoft. So, Chendoes not even have access to the Visual FoxPro 9 source code.Yet somehow, since 2012, Chen is publicly releasing “updates” to VFP9 as a product calledVisual FoxPro Advanced.How does Chen do this?It may seem like an impossible task, since there is no source code. Chen doesn’t even haveaccess to Intermediate Language source code he could get from decompiling a .Netapplication.According the Chen himself, it is indeed “very difficult” because he only has access to thecompiled binaries, the same as you and I. When a need for a change is identified, hepainstakingly wades through the binary code to identify the area that needs modifying,codes and tests his changes, and then writes the altered binary back out to a new binary. Ipersonally can’t imagine undertaking this endeavor, yet Chen has done it. “Very difficult?” Ithink Chen is modest and understated. See Appendix B for a sample of his work.Is this safe?A valid question. We don’t know what changes he’s made to the development environmentor the new runtimes. Could Chen have added code that subversively ships data out the doorwithout our knowing it? This would be a fairly easy thing to check by enabling the logs onyour firewall and watching where data goes when your application is running. If it turnedout to be happening, his reputation would be immediately ruined once word got out.My anti-virus software did actually flag the download as “potentially unsafe,” but that wasbecause it had no “reputation” yet. So few people have downloaded VFPA that Symanteccouldn’t assure me that it was safe.He could also have inadvertently introduced a bug to Visual FoxPro that wasn’t therebefore, but according to Chen he has over 600 people that use and test Visual FoxProCopyright 2019, Eric SeljePage 3 of 31

VFP Advanced: Is This the Next Visual FoxPro?Advanced, so if something was amiss he would hear about it. One of his main customers isChen himself. He has written management systems in VFPA that are used by manycustomers in restaurants, factories, and other businesses.Another customer is Frank Moore of FWM Software in California(http://www.fwmsoftware.com). Mr. Moore uses VFPA to develop and deploy hiscommercial software application, LienWriter. He has told me he has had virtually zeroissues with VFPA, and indeed its bug fixes and new features have been invaluable to him.But as it says at the bottom of each of Chen’s fix reports, “There is no guarantees.”Is Microsoft cool with this?According to Chen, Microsoft has been aware of what he’s doing for quite a while. Theirofficial response is “We appreciate you reaching out to Microsoft about this application.However, we cannot comment on legality because it was created by a separate entity that isunaffiliated with Microsoft. I recommend continuing to proceed with caution and perhapsrequest that the company provide you with proof of legal ownership as well as legality ofdoing business with US customers.” I’m no lawyer, but the “proceed with caution” leavesthe door open for Microsoft to put their foot down if they wanted to, but at this pointthey’ve got bigger fish to fry.As extra precautions against legal issues, Chen does not change any copyright informationanywhere in the product as well, and he’s selling Visual FoxPro Advanced for exactly 0.00(which as of this writing converts to USD 0.00). He would like anyone who uses it tosubscribe to support and services for a whopping 10,629.50 (or USD 100) per year.How do I get VFP Advanced?All right so you’re convinced to give VFPA (a clever acronym, as we know A is hex for ‘10’) atry. This first thing you must do is have a licensed copy of Visual FoxPro 9 on your systemand have it patched to version 9.0.0.7423. If you don’t, VFPA’s setup routine will tell youthat you haven’t met the prerequisites and fail.Table 1: VFPA PrerequisitesFile nameVFP9 IDEC:\Program Files (x86)\Microsoft Visual Foxpro 9\Vfp9.exeVFP9 IDE language resource fileC:\Program Files (x86)\Microsoft Visual Foxpro 9\Vfp9enu.dllVFP9 RuntimeC:\Program Files (x86)\Common Files\Microsoft Shared\VFP\Vfp9r.dllVFP9 Multi-threaded RuntimeC:\Program Files (x86)\Common Files\Microsoft Shared\VFP\Vfp9t.dllVFP9 Runtime language resource fileC:\Program Files (x86)\Common Files\Microsoft 0.0.58152007-10-151,187,840If you don’t have your Visual FoxPro 9 completely patched up to service pack 2, hotfix 3already, you can get Service Pack 2 from visualstudio/foxpro/mt490117(v msdn.10) and HotFix 3 fromCopyright 2019, Eric SeljePage 4 of 31

VFP Advanced: Is This the Next Visual FoxPro?https://github.com/VFPX/VFP9SP2Hotfix3. They are also conveniently available on Chen’swebsite.To get VFPA itself, go to Chen’s website athttp://www.baiyujia.com/vfpadvanced/f vfpa about.asp. Near the bottom are thedownload links for both the 32 and 64 bit versions.Installing is very straightforward. You can install either or both of these versions of VFPAright alongside your existing Visual FoxPro 9. The installer doesn’t do anything at all toyour original VFP installation folder(s).After VFPA is fired up for the first time, the experience is so much the exact same as thefirst time VFP9 started, right down to the Task Pane Manager (Figure 1) that you willimmediately disable from startup. But a quick check of the About screen (Figure 2) revealsthat this is indeed the updated version.Figure 2: Version 10!Figure 1: Remember Me?Just to doublecheck though, let’s try? version()And lastly, notice the new caption at the top:Already Chen’s done more than I would have been able to, but there’s so much more!Copyright 2019, Eric SeljePage 5 of 31

VFP Advanced: Is This the Next Visual FoxPro?Does it Work?After verifying that I was indeed running VFPA and not VFP9, I poked around a bit.Everything looked exactly the same as VFP9, and that’s because (and this is important tokeep in mind), it is the same. VFPA is VFP9, but with some internal changes. The UI,designers, and compiler are the same. The runtime is merely a patch of the existing VFP9runtimes, in order to support the new features, although it does do something interesting:it incorporates all of the separate language files into the VFPA runtime. This reduces thenumber of files you may need to ship with your application but increases its size. I’d showyou a screenshot to emphasize the point, but you would just say “That looks just like VFP9.”The next thing I attempted to do once I started VFPA is to see if it was compatible withexisting applications. I started with something I use every day: GoFish5. This is a good testbecause GoFish uses low level functions, ActiveX controls, and local DBF tables. It workedperfectly.Next, I tried one of my own work applications, one that uses ODBC to talk to an Informixdatabase. I can’t show you a screenshot because the data is proprietary, but it workedperfectly.I checked Thor, FoxUnit, FoxTabs, and Project Explorer: all worked perfectly.Copyright 2019, Eric SeljePage 6 of 31

VFP Advanced: Is This the Next Visual FoxPro?Almost convinced, I checked another custom application of mine. On this one I wanted toactually make some changes, compile it, and run it. The entire experience was just likeVFP9 (again, because it really is mostly VFP9). When I ran the application though I noticeda little quirk with the menu: there are two Window menus. Can that be right?I fired up VFP9 to run the program to see if this problem existed back in VFP9 as well.When I ran the application it said:Well of course it does – that makes sense. I had compiled the app in VFPA, so VFP9 won’trecognize it. Fair enough. I recompiled it with VFP9 and ran it again:It’s still there! So VFPA even reproduces some of the quirks of VFP9. When I hover mymouse over the 2nd Window menu in either version, it changes to the proper Help menu. I’llhave to dig into this further, but it doesn’tappear to be an issue with VFPA itself.What New Features and Fixes?Satisfied that VFPA is at least as solid as VFP9, let’s look at what it adds to the mix. The firsttime I heard that Visual FoxPro Advanced fixes over 80 bugs (and counting) in VisualFoxPro 9, I wondered how it is that I’ve haven’t heard about all these issues. Well theanswer is that Visual FoxPro 9 was a mature product that works for 99.99% of the peoplewho use it. But there are quite a few esoteric issues and limitations with VFP9 that you mayhave even noticed depending on the nature of your application. And if you did hit one ofthese issues or limitations, it might be a deal breaker for your application!In Appendix A, I’ve enumerated all the fixes and new features from Chen’s website andexpanded their descriptions. New features have a green bar next to them to identify themeasily. Let’s highlight a few of these.Copyright 2019, Eric SeljePage 7 of 31

VFP Advanced: Is This the Next Visual FoxPro?SYS(9000)I’m going to start with my favorite new command, SYS(9000). This command enables Fix18, which disables the “shadow” of dockable windows such as the Command Window. InWindows 10, and especially on my 4k monitor, this shadow either lagged far behind whereI was dragging or had no relationship at all to my mouse movement. This drove me nuts,and now it’s fixed, and that would be enough for me right there to use VFPA.OS()Let’s assume your company has moved to Windows 10 (and I really hope it has, becauseWindows 7 extended support ends in January, 2020), and you want to add features to yourapplication that only work with Windows 10, like sending “toast” notifications to the ActionCenter.In VFP9, there was no way to distinguish which version of Windows you were runningbeyond 7. OS() returns Windows 6.02 regardless if you were running Windows 7, 8, or 10because there was no version 8 or 10 the last time VFP9 was officially patched. VFPA fixesthat by returning Windows 10.00. Now you can have code that acts differently.Now you may have code that will actually break if OS() doesn’t return “Windows 6.02”.Chen has thoughtfully added a bunch of new SYS(90##) functions that will enable ordisable many of the fixes that he’s made, so your application can retain backwardcompatibility if necessary. For OS(), SYS(9019,0) will disable the new functionality, causingit to return the same thing it would in VFP9. Other SYS(90##) functions follow the samepattern.Bitwise CalculationsSuppose you have a field in your table that uses bits as flags rather than separating theminto separate logical fields (a fairly common thing). VFPA adds bitwise operators to theCALCULATE command, which is much easier than using MOD() or other methods todetermine if a flag is set for any of your records (see Code Block 2).Copyright 2019, Eric SeljePage 8 of 31

VFP Advanced: Is This the Next Visual FoxPro?CREATE TABLE userrights FREE (userid i, rights i)* 0 Read Only Accounts Receivable* 1 Can write to the Accounts Receivable* 2 Read Only Accounts Payable* 4 Can write to Accounts Payable* 8 Read Only Payroll* 16 Can write to Payroll* .* 128 Admin* 256 SuperUser* Insert some usersINSERT INTO userRightsINSERT INTO userRightsINSERT INTO userRightsINSERT INTO userRightsINSERT INTO userRightsINSERT INTO userRightsINSERT INTO userRightsINSERT INTO userRightsINSERT INTO 1,(2,(3,(4,(5,(6,(7,(8,(9,0) && 000000001) && 0000000123)&& 0001011156) && 0011100034) && 00100010148) && 10010100128) && 1000000065)&& 0100000152)&& 00110100* We can now do this to determine who can do what.CALCULATE BAND(rights), BOR(rights), BXOR(rights) TO bAnd, bOr, bXOr? m.bAnd && Which rights does everybody have? m.bOr&& Which rights does nobody have? m.bXOr && Which rights does an odd number of people have?* 109 64 32 8 4 1Code Block 1: New operators for CALCULATEVFPA Fixes BugsHave you ever been debugging your program and the debugger stops at the Trace windowon a line of code t

In this session, we'll dive into this free patch for Visual FoxPro. We'll go over some (but not all 81, as of this writing) bugs that it fixes, discuss what being 64-bit does for us, and have a conversation about whether you want to develop and release software that uses this patch. Is it dangerous? Buggy? Well-supported? Let’s find out VFP Advanced: Is This the Next Visual FoxPro .