Starting Visual FoxPro

If you are working on many Fox projects at once then it's useful to have separate icons for each one on the desktop. Use FoxPro's -c startup switch to make each of these shortcuts lead to a different project.

Create a new shortcut to VFP.Exe on the desktop and add the -c switch to the program name:

'D:\Visual Studio\Vfp98\VFP6.EXE' -cconfig.mkt

This tells FoxPro to use the config.mkt file instead of the usual configuration file config.fpw. The FoxPro config file is a plain text file which Fox reads as it loads.

You can set development options in the config file itself but it's better to just use the config file to run a program. You can then run this same program to reset your development environment during testing.

Put the following line in the config.mkt file:

COMMAND = DO e:\devestud.458\MrktStrt.Prg

Note that the program name is fully-pathed. You'll see the reason for this later.

Now you need to write the startup program itself:

*-- Startup program called by Config.mkt to load the
*-- development environment for the Marketing
*-- project.

*-- Clean everything up
CLEAR MEMORY
CLOSE DATA
CLEAR ALL
CLOSE ALL
SET SYSMENU TO DEFAULT

*-- Get rid of the standard toolbar.
*-- It's just a waste of screen space.
IF WVISIBLE ('Standard')
   RELEASE WINDOW 'Standard'
ENDIF

*-- Make the screen green-on-black with 'Marketing'
*-- as the title.
*-- Each of my projects is a different colour so as
*-- I know where I am.

WITH _SCREEN
   .BackColor = RGB (0, 0, 0)
   .ForeColor = RGB (0, 255, 0)
   *-- Reset to Courier font in a legible size.
   .FontName = 'Courier New'
   .FontSize = 10
   .Caption = 'Marketing Development'
   .cls
ENDWITH

*-- Go to the Marketing development home directory
cd e:\devestud.458\Dev

*-- Set the F12 key to call this program
PUSH KEY CLEAR
ON KEY LABEL f12 DO e:\devestud.458\MrktStrt.prg

*-- Open the Market project.
*-- Note the NOWAIT option.
MODIFY PROJECT ContMan NOWAIT

*-- Finally activate the Command Window
*-- (just in case it's been closed).
ACTIVATE WINDOW COMMAND

Now if you close FoxPro and click on the new shortcut, you'll be ready to start work immediately - in the right directory with the right project open. The screen caption will remind you what project you're working on today and whenever your test runs fail to clean up correctly you'll be able to press F12 to reset the environment.

FoxPro has a very open architecture with all the details documented in the Help system or on-line and there is no real limit to what can you can do to make the environment more comfortable and productive. You can manipulate the _screen object to add controls to the desktop. More details about adding controls to the FoxPro screen here.

Related Items

FoxPro configuration file

Using and distributing the FoxPro configuration file

Read More

FoxPro at development and runtime

Switching between Foxpro development and runtime

Read More

FoxPro command line switches

FoxPro command line switches

Read More

VBA Code for Events in Access

How to open the VBA method code editor automatically in Microsoft Access

Read More

Startup Options for a Microsoft Access database

Different ways of using the Access StartUp options to improve database security

Read More