ActiveVFP FAQ

Coordinator
Oct 29, 2011 at 2:05 PM
Edited Jan 30, 2013 at 12:42 AM

Q:  Is there any advice you can give an experienced desktop VFP Developer to lessen the learning curve with ActiveVFP and make it easier to create VFP web applications?

I think the learning curve for most people is for web programming in general and not necessarily AVFP:

  1. Regarding installation, you just need to keep in mind the following:
    Use ActiveVFP 6.03 for Windows VISTA or above (Home Premium,Professional,Server,Enterprise,Ultimate)
    Use ActiveVFP 5.53(for ASP.NET 2.0) for Windows 2003 Server (can use on all supported Windows versions)
    Use ActiveVFP 5.53(for ASP.NET 1.1) for GoDaddy
    After that you basically create a directory, unzip the contents there,
    create either an IIS Application (IIS 7 or above) or Virtual Directory (IIS 6) in IIS Manager,
    and then bring up the demo app in your web browser.
    GoDaddy installation is slightly different and can be found here.
    Detailed IIS installation instructions can be found here.
  2. As far as learning new programming, there are really only 3 main new objects to learn in AVFP (if you're new to web programming): Request, Response, Session. That's it!!  You use these objects in FoxPro code.
  3. If the VFP code in the Demo application is examined, the use of Request, Response, Session is demonstrated pretty thoroughly. (If these objects look familiar, it's because they're the exact same objects used in Classic ASP!)
  4. Web applications are stateless, meaning everything starts with a blank slate on each web hit. Use the Request Object to get submitted form values or values passed on the URL.  Use the Session Object to maintain state between web hits for anything involving more than a couple of pages.
  5. AVFP doesn't convert existing FoxPro GUI Forms, you have to use HTML for the interface. Use CSS/JavaScript/jQuery to make the web interface more interactive if you want to get fancier.
  6. AVFP doesn't use Controls on Forms like desktop VFP to create web interfaces. Preferably you would use an HTML WYSIWYG editor like DreamWeaver or MS-Expression to create HTML forms and style your interface.  These editors can automate a lot of the interface building and are generally better at web design then even Visual Studio imo.
  7. Take advantage of the Discussions knowledge base.  Ask a question or search through years of questions and answers to find solutions for problems like you may have.  A quick way to do a search other than the provided form is http://activevfp.codeplex.com/discussions?searchText=yourissue
  8. More help here.

Q:  I don't know much about web stuff, so please excuse a basic question:
What makes it work? When you start the demo, how does it know to create oProp and use your DLL?

Ok, here's a quick overview starting from the user's browser when they contact your web site:

  1. aspnet_isapi.dll - highly optimized raw call from IIS
  2. custom HTTPhandler (6.03) or default.aspx (5.53) gives us Request, Response, Session objects, it also has the very desirable effect of creating an STA thread pool and processing requests for that page with STA threads which we need for VFP.  Sounds complicated but most is done automatically!
  3. call ActiveVFP.dll main VFP "Process" method which is just a small proxy (proxystub.prg) that sub-classes the base Request, Response, Session objects and creates other objects like oProp. Then it ExecScript 's main.prg
  4. Main.prg (optional to code in)- this is just a prg that does all pre-processing and post-processing. For example, set up your data access once here instead of each page.
  5. your.avfp page - this is where most of your code might go. Any .avfp page is automatically setup to be called and processed by main.prg which is why using main.prg is optional and you can just code a test.avfp in NotePad with VFP code and it will just work!!

The basic idea is to make ActiveVFP like PHP. Easy yet powerful.

Q:  Is there an interactive mode where one can see the steps it goes thru?

Yes!  With AVFP version 5.53, you can use Visual Studio to step through all of the FoxPro code in AVFP and your application, including the script files.  You'll need Visual Studio to launch the debug.aspx script and also Visual Foxpro 9 to use the regular VFP debugger to step through code.  I tested successfully with Microsoft Visual Studio 2010 and Visual FoxPro 9.  (Unfortunately I wasn't able to get the debugger working with HTTP Handlers so, at this point, there is still no interactive debugging in 6.03.  See other techniques in the docs.).  Full description is in the Documentation.

Q:  I am using CoffeeCup HTML editor to look at the *.avfp files. All the HTML stuff interferes with seeing clearly how it works, but I guess one just has to get used to it. Is an HTML editor the best way to create / review the code or something else? Also do you use anything to make the forms?

WYSIWYG HTML editors are the best like MS Expression or Dreamweaver. CoffeCup should fall into that category too. All the VFP code is between the <% %>.
BTW, you can code <% %> right in the display side of a WYSIWYG editor and AVFP is smart enough to know how to decipher those codes when run!!
Or you can code in .prgs in the VFP IDE and just call the .prg from the .avfp. You decide what's easiest and best for you.

Q:  How can I show support for ActiveVFP?

Firstly, you can download, install, and work with ActiveVFP in your own project.  Secondly, you could try to answer some of the questions in the discussion forum here.  And, if you're really feeling confident about your abilities, you can contribute code to ActiveVFP in the form of fixes and/or new features and feel good about being an active participant in open source software!

You can also donate money to help support ActiveVFP and open source VFP projects.

--
Donations
Donations are accepted.
Click here to donate to help support ActiveVFP and Open Source VFP projects.

Donate!


Thank you for your support!