Showing posts with label Foxpro. Show all posts
Showing posts with label Foxpro. Show all posts

Monday, November 16, 2009

Foxpro Notes 2: Steps to Build Foxpro Application

If you meet problems when building a runnable exe with Visual Foxpro 9.0 (VFP9), here are some guides for you. (It takes some time for me to search through the forum, damn Microsoft!)

  1. Create the main form, eg. "frmmain.scx"

  2. Create a program and set it as main, eg. "prgmain.prg", with following code:
    Line 1: ON SHUTDOWN QUIT
    Line 2: DO FORM "../forms/frmewsmain.scx"
    Line 3: READ EVENTS

  3. Press "Build.." button on "Project Manager" window to create exe

  4. Copy the "config.fpw" from project folder to the exe folder. Change "SCREEN = OFF" to "SCREEN = ON"

  5. Get "vfp9r.dll" and "VFP9RENU.DLL" from "\Program Files\Common Files\Microsoft Shared\VFP" to the exe folder

  6. Place the exe and data properly and you will be able to run the exe


Note: If you create your own menu and find that you cannot compile the program, change the environment variable "_GENMENU" to locate the "genmenu.prg".

Sunday, October 18, 2009

Foxpro Notes 1: Modification on Foxpro Auto-generated Stored Procedure

Last tuesday, I was being asked to support development with Visual Foxpro 9.0. I have setup Foxpro database according to specification except foreign key constraint. The auto-generated foreign key constraint will restrict the direct data entry from the form.

I have looked for help at "www.foxite.com". Tushar from India has provided me 2 clues to derive the solution. Really appreciate for his help.

  1. Add "IF !EMPTY(foreignkey)" to bypass the foreign key constraint checking code


  2. Add round brackets () for the variable lcParentWkArea in statement "unlock record pnParentRec in lcParentWkArea". Thhe new statement is "unlock record pnParentRec in (lcParentWkArea)"