Can t touch this, or can you?


Can ‚ t touch this, or can you?

There are a number of files included in Visual FoxPro available for you to use in your custom solutions. Some of these files can be redistributed, others cannot. This section delineates what you can and cannot use, what special conditions need to be met to distribute some of the files, and what copyright issues need to be evaluated.

Note ‚  

Please note that this discussion is based on the latest licensing agreement for Visual FoxPro 8. If you are using another version please consult the ‚“Distributable and Restricted Visual FoxPro Features and Files ‚½ topic in the help file ‚ not ‚“Removing Restricted Visual FoxPro Features and Files" as stated in the Redist.txt file. We highly recommend you consult the Redist.txt file to verify the files you want to use are included in this file.

REDIST.TXT in the VFP home directory defines which of the files can be redistributed. Here are the categories:

  • Merge Modules are okay to use in a distribution

  • Code that can be shipped

  • Wizards and Builders that can be included

  • Tools (Filer, zeroing code pages program, FoxISAPI, GenDBC)

  • Component Gallery directories

  • Fox Foundation Classes

  • Graphics

  • Samples

  • Tools (the automated testing application)

You can use the Samples source code, bitmaps (BMP), icons (ICO), and mouse cursors (CUR) files in your applications as long as they are compiled into the executable. They cannot be distributed externally, separate from the executables. Naturally, you can borrow any ideas and source code to be included in your own creations.

Similarly, you can use any of the Fox Foundation Classes (FFC) found in the FFC directory under the VFP home directory and the Wizard classes (utilized in the VFP Framework and various code and application generating wizards), classes included in the Component Gallery, without modification in your applications as long as they are compiled into distributed executables.

One of the surprises developers hit when they review the list of files that cannot be distributed is the TrueType fonts installed with Visual FoxPro, most notably FoxFont and FoxPrint. While these fonts are less useful today than they were during the 2.6 to VFP 3 conversion, they are still used by some developers during development. We suggest just ignoring this font and using another font, otherwise your customers will need to purchase a license for Visual FoxPro for each computer on which the application is to be executed.

You cannot ship any of the Visual FoxPro help files (VFP 8 ships dv_foxhelp.chm and FoxTools.chm). This should be obvious, but we aim to cover all the details for you.

Several menu options available in the Visual FoxPro Interactive Development Environment (IDE) cannot be included in a deployed application (see Table 2 ). This means you can ship the Report menu with your application and can include the capability of user defined reports and labels.

Table 2. This is a list of VFP Menus and menu options that cannot be shipped:

Menu Item

Database

Form

Menu

Program

Project

Query

Table

A number of the Wizard files cannot be included in your custom applications. The files that can be included are specified in the Redist.txt file. Now you might be asking why a developer would be concerned with the inclusion or exclusion of the Wizard files. After all, most of our customers are running a business and are not using Visual FoxPro to develop applications, so why would they need the functionality included in the Wizards? The fact is they are not likely to need most of them and it is important to note that Microsoft is not providing us the rights to distribute all of the wizard code. The benefit we see with this aspect of the redistribution license is our customers can use the functionality of the report wizard if we provide them with the Report Designer, the Pivot Wizard if we include a capability to generate Excel Pivot tables, or the Import Wizard if our clients request the ability to interact with different data import capabilities. Instead of writing this code from scratch, we can include the wizards with the functionality already developed. We once again recommend reviewing the Redist.txt file for all the specifics on which files you can and cannot distribute.

Along with the specified files, there are several commands that don ‚ t work in the executables we ship. These trigger the ‚“Feature Not Available ‚½ error (number 1001) we all hit at one time or another in unit or system testing. These errors are inexcusable if they happen in production. Microsoft provides this list in the help file (see Table 3 ). Often they happen in production because developers do not test the code as an executable with the runtimes before shipping the application to the customers.

Table 3. This is a list of VFP commands that trigger the ‚“Feature Not Available ‚½ error.

APPEND PROCEDURES

MODIFY DATABASE

BUILD APP

MODIFY FORM

BUILD EXE

MODIFY MENU

BUILD PROJECT

MODIFY PROCEDURE

CREATE FORM

MODIFY PROJECT

CREATE MENU

MODIFY QUERY

CREATE QUERY

MODIFY SCREEN

CREATE SCREEN

MODIFY VIEW

CREATE VIEW

MODIFY CONNECTION

‚  

SUSPEND

The Code Reference tool was introduced in Visual FoxPro 8 (see Figure 7 ) and is used to search projects for the ‚“Feature Not Available ‚½ commands. Before Visual FoxPro 8 (and still, even with the advent of the Code References tool) we use tools like the Project Searcher from Steve Dingle (available from www.SteveDingle.com ) and Peter Diotte ‚ s GoFish (available on the Universal Thread ‚ www.UniversalThread.com ). Another approach you can take is to write a process that searches the project source code for the problem commands in the BeforeBuild method of a projecthook. The key is to check for these commands before doing the final build you send to the customer. The most likely command to give you problems is the SUSPEND command because it is commonly used when debugging code.


Figure 7. The Visual FoxPro 8 Code References Tool gives developers the ability to search for strings and open the code in the appropriate editor.

There are seven commands (see Table 4 ) completely ignored in a runtime application as well. This means you can include them in your code, and they have no effect in the application. The ASSERT , DEBUGOUT , and SET STEP commands are useful in your debugging endeavors, but will play no part in the end user aspect of the applications.

Table 4. This is a list of VFP commands ignored in your runtime applications.

ASSERT

SET DOHISTORY

DEBUGOUT

SET ECHO

SET DEBUG

SET STEP

SET DEVELOPMENT

‚  
Note ‚  

The SET STEP command was moved to the list of ignored commands in runtime applications starting with Visual FoxPro 7, but still remains in the Help file as a command that still triggers the "Feature Not Available" error.

We decided to do some performance testing of ignored commands to see if including them in our application would have a negative effect on performance. While it is nice to not worry about the commands triggering some error condition, we don ‚ t want to include commands that can slow our applications by a margin that would have our users asking for some performance improvements. We took the commands most likely to be left in our applications after we completed unit testing. The commands are the ASSERT , DEBUGOUT , and SET STEP commands. Here is the program we used to test the conditions (program TESTIGNORECOMMANDS.PRG is included in the chapter downloads):

 lnLoops = 100000  * Nothing  lnStart = SECONDS()   FOR i = 1 TO lnLoops   * Nothing  ENDFOR   lnEnd = SECONDS()   WAIT WINDOW "Performance of nothing: " + TRANSFORM(lnEnd - lnStart)   * DEBUGOUT  lnStart = SECONDS()   FOR i = 1 TO lnLoops   DEBUGOUT "Nothing in Executable"  ENDFOR   lnEnd = SECONDS()   WAIT WINDOW "Performance of DEBUGOUT: " + TRANSFORM(lnEnd - lnStart)   * ASSERT  lnStart = SECONDS()   FOR i = 1 TO lnLoops   ASSERT .F. MESSAGE "Nothing in Executable"  ENDFOR   lnEnd = SECONDS()   WAIT WINDOW "Performance of ASSERT: " + TRANSFORM(lnEnd - lnStart)   * SET STEP  lnStart = SECONDS()   FOR i = 1 TO lnLoops   SET STEP OFF  ENDFOR   lnEnd = SECONDS()   WAIT WINDOW "Performance of SET STEP: " + TRANSFORM(lnEnd - lnStart)   * WAIT NO WAIT  lnStart = SECONDS()   FOR i = 1 TO lnLoops   WAIT WINDOW "Nothing" NOWAIT  ENDFOR   lnEnd = SECONDS()   WAIT WINDOW "Performance of WAIT NO WAIT: " + TRANSFORM(lnEnd - lnStart)   RETURN  

As you can see we also included the WAIT NO WAIT command because this is a command commonly used by developers to show progress during a long running process and it demonstrates how much the ignored commands have little to no impact on your production code. The test results are specified in Table 5 . The conclusion we draw from this test is the ignored commands have virtually no impact on the performance of your runtime applications.

Table 5. The average timing results of the TestIgnoredCommands.exe when run with 100,000 iterations of each command as well as a loop that does nothing. Testing performed on a Pentium 4M 2 GHz processor with 512MB memory.

Command

Time

Nothing

.012

DEBUGOUT

.060

ASSERT

.033

SET STEP

.033

WAIT NO WAIT

14.537

Visual FoxPro ships with some standard ActiveX controls you can include in your applications and distribute to your customers without a royalty payment. Each version of Visual FoxPro since version 5.0 has a different set of ActiveX controls (see Table 6 through 8 ).

Table 6. ActiveX controls that ship with Visual FoxPro 8.0 and can be distributed with your deployment package.

File

Controls

Help file

MSComCt2.ocx

Animation control
DateTimePicker control
MonthView control
UpDown control

CmCtl298.chm

MCI32.ocx

Multimedia MCI control

MMedia.chm

MSChrt20.ocx

MsChart control

MsChrt98.chm

MSComCtl.ocx

ImageCombo control
ImageList control
ListView control
ProgressBar control
Slider control
StatusBar control
TabStrip control
Toolbar control
TreeView control

CmCtl198.chm

MSComm32.ocx

MSComm control

Comm98.chm

MSInet.ocx

Microsoft Internet Transfer control

Inet98.chm

MSMapi32.ocx

MAPI Message control
MAPI Session control

Mapi98.chm

MSMask32.ocx

Masked Edit control

Masked98.chm

MSWinSck.ocx

Winsock control

MsWnsk98.chm

PicClp32.ocx

PicClip control

PicClp98.chm

RichTx32.ocx

Rich Textbox control

RtfBox98.chm

SysInfo.ocx

SysInfo control

SysInf98.chm

Table 7. ActiveX controls that ship with Visual FoxPro 7.0 that are different from VFP 8.0.

File

Controls

Help file

Foxtlib.ocx

Foxtlib ActiveX control

Foxhelp.chm

Table 8. ActiveX controls that ship with Visual FoxPro 6.0 that are different from VFP 7.0.

File

Controls

Help file

ComCtl232.ocx

Animation control DateTimePicker control MonthView control UpDown control

CmCtl298.chm

FoxHwnd.ocx

Visual FoxPro HWND control

FoxHelp.chm

MSWless.ocx

CheckBox control (Lightweight)
ComboBox control (Lightweight)
Commandbutton control (Lightweight)
Frame control (Lightweight)
HscrollBar, VScrollBar controls (Lightweight)
ListBox control (Lightweight)
OptionButton control (Lightweight)
TextBox control (Lightweight)

Ltwtct98.chm

Not only do the ActiveX controls need to be deployed, they also need to be registered on each workstation that will run the application. This could be one computer in the case of a single-user application or Web server, or it could be literally hundreds of computers in the case of a large corporate deployment. We will discuss the specifics of the distribution and registration in various chapters throughout this book and address this in each of the How-To appendices.




Deploying Visual FoxPro Solutions
Deploying Visual FoxPro Solutions
ISBN: 1930919328
EAN: 2147483647
Year: 2004
Pages: 232

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net