Hide the main VFP system window
Most Viusual FoxPro applications appear as forms within the main VFP system window
and users work with the menu bar in that window. This is a good model for
many traditional FoxPro systems because they tend to be the sort of
large-scale applications which users spend the entire day with; things
like accounts packages and stock-control systems. Sometimes though you
want a more modern appearance where the application appears as a
free-floating form on the main Windows desktop. This is not difficult.
You need to make two adjustments to your design to achieve this effect.
The first is to release the FoxPro form from the confines of the main
VFP system window; the second is to turn off the main VFP window.
Releasing the form is easy.
Go to the Layout tab of the main form's properties window and
change the ShowWindow property. This will be 0 (in screen) by default.
Change it to 2 (As Top-Level Form). For the other forms in the application
you have the choice of setting them to 1 (In Top-Level Form) or
2 (As Top-Level Form) depending on how you want them to behave.
Hiding the main VFP window is a little more difficult. The obvious way to
do it is to set the Visible property of the screen object:
_screen.Visible = .F.
This will work but even if you make this the first line of the first
program in your application, you will still see the VFP window flash on
and then disappear. You need to find a way to turn the screen off
before the application starts and the way to do this is to use the
FoxPro Config file.
Create a new Config.Fpw file and put this line in it:
Note that there is no underscore here. The Config file is not referring to
the _screen object.
If you need to distribute this application then you must make sure that
the users have the right Config.Fpw file. You can avoid any confusion
by including the config file in the project and building it into the
Go to the Text Files entry of the Other tab of the Project Manager, Add
File and select Config.Fpw. Fox will now build this file into the
executable and you will not need to distribute the config file itself.
It is always worth building the Config.Fpw file into the executable even
if you are not using it to hide the screen. The executable will use the
built-in file even if there is another Config.Fpw in the same folder as
This use of the config file can make development work difficult unless you
are careful. It is very difficult to open the FoxPro development
environment if Fox has just read and processed a Config.Fpw file which has
told it to turn the screen off. The solution is to put the runtime
Config.Fpw into another folder away from the home folder which holds the
pjx and pjt files and to put a dummy file into the home folder. VFP
itself will use the local Config.Fpw and the executable will use the
one which has been included in the project.
Use this technique to
customise the FoxPro environment
to make sure that your development environment is using
the correct configuration file.