3

Tips on Developing
EXE’s in VFP
By John Melton

In the process of producing executable files in VFP, I have encountered a number of problems, some frustrating, that might be of interest to anyone attempting to develop EXEs. I have listed a few of these items below.

-Start-up screen in EXE’s - The initial screen when running an EXE created in VFP starts up as normal rather than maximized. This cannot be controlled through the Fox configuration file or pre-startup programming. Preferring a maximized window, the only viable solution I have been able to find is to add one of the following two commands to the main program as one of the first lines of code:
_SCREEN.WINDOWSTATE=2
-or-
ZOOM WINDOW SCREEN MAX

Though both of these work, neither prevents the main window from initializing in the normalized view. Consequently, the user sees the screen start up as normal and then change to maximized a moment later (and it’s not pretty). I have been told that other developers have not had this problem, but Microsoft has confirmed that by default the initial screen is not maximized.

-Preventing ‘Microsoft Visual FoxPro’ in the title of the main window at start-up - The best method I have found to prevent the words ‘Microsoft Visual FoxPro’ from appearing in the title bar of the main window at startup is, first, to include the following command in a config.fpw file:
TITLE=

This causes the title bar to be blank initially. The config.fpw file can be included in your project under the ‘Other Files’ section. Second, the caption you prefer, such as ‘My Program,’ can be added as one of your first lines of code in your main startup program as follows:
_SCREEN.CAPTION’My Program’

The reason for not putting the caption in the config.fpw file initially with the TITLE command is because of the normal vs. maximized problem mentioned above, If it is included in the config.fpw file, it will appear in two positions as the screen changes from normal to maximized. For the same reason, the _SCREEN.CAPTION command should come after the command to maximize the screen.
-Turning off the VFP menu - The config.fpw file can also be used to turn off the VFP menu by adding the following command:
SYSMENU=OFF

Otherwise, the user first sees the VFP menu and then sees it change to the programmed menu.

-Standard Toolbars on EXE- in the figure this one out department, I found out the hard way that if you assign a unique resource file to an application, e.g., SET RESOURCE TO MyFile, and then build an executable and run it, the main window includes the design-time standard toolbar! Even worse, it may affect other VFP projects on your system. And guess what - according to Microsoft, this behavior is by design! Fortunately, the solution is easy. While running the executable, simply close the toolbars (you may have to re-dock them to activate the close box) and they never appear again, even in subsequent builds. This procedure must be run for each project affected. Go figure!

- 16 bit networks and Win32s - If you are running your program on a network, each machine running Windows, WWG, etc. must have Win32s installed. This can be done using the set-up wizard with a dummy application file. Simply set up a sub-directory with a dummy file in it (such as Dummy.txt) and run the setup wizard as if it was your application file. Select Win32s as the only optional component. This produces 3 disks. Simply run the set-up program on any machine in which you need to install Win32s.

- ESL file and networks - Each machine must also have the monster (3.7 meg) VFP ESL file and related files in the Windows System sub-directory. This can be added to the process outlined above. Simply select the Visual FoxPro 3.0 Runtime option when running the setup wizard.

I hope this saves you some time in getting EXE’s up and running. I have found the Microsoft Knowledge Base very helpful in resolving the kind of ordinary problems most of us run into such as these.

(John Melton is President of CFO Software and is on the Board of Directors of the Rocky Mountain Fox User Group in Denver, Colorado. He has been developing database applications in dBase and FoxPro for 12 years. He can be reached by phone or FAX at (303) 699-5888 or internet e-mail at meltonj@ix.netcom.com)
Page 3

3