Microsoft® Visual FoxPro version 5.0 is the newest version of the Microsoft object-oriented environment for database construction and application development. Visual FoxPro version 5.0 gives a developer the necessary tools to manage data--whether organizing tables of information and running queries, creating an integrated relational database management system (DBMS), or programming a fully developed data management application for end users.
This guide is designed to help you evaluate Microsoft Visual FoxPro version 5.0. You'll find highlights that cover features, including new client/server capabilities, and features that maximize a developer's time.
Background of Visual FoxPro
Visual FoxPro version 3.0 shipped in June 1995 and was generally recognized as an extremely successful release. Visual was added to the product name to signal that it is a more tools-oriented, less language-oriented approach to developing database applications. Previous releases have included FoxPro version 2.6 for Windows®, MS-DOS®, Apple Macintosh, and Unix.
Visual FoxPro version 3.0 introduced new functions for developers using FoxPro, including:
- Object-oriented improvements, such as classes, polymorphism, inheritance, and visual tool support for ease of object creation and reuse.
- Client/server development paradigm, so a developer can develop locally and deploy remotely.
- Data dictionary support to centralize database logic. In prior versions, logic resided primarily in forms and screens, which could make coding and maintenance more difficult.
Besides moving from a procedural-oriented to an object-oriented paradigm, Visual FoxPro version 3.0 reduced its focus on the xBase language, which by mid-1995 had begun to decline in popularity. A new approach, similar to that found in mainstream development tools, used the dot notation and property sheets to control object properties, events, and methods. Version 5.0 continues this trend.
The Microsoft Visual Tools Family
Microsoft Visual FoxPro version 5.0 is a member of the Microsoft Visual Tools family, which also includes Visual Basic® programming system, Visual C++®, and Visual J++. Developers use the Visual Tools family to easily integrate Internet technology with client/server solutions. Developers use Microsoft Visual Tools to build scalable, open, and comprehensive applications. For example, developers can build:
- Applications that scale to fit requirements regardless of the size of the solution, from standalone to three-tier enterprise to Interactive Web sites.
- Applications around open standards that support choice, flexibility, and cross-platform options to honor broadly adopted standards, such as those driven by organizations like the W3C, IETF, Open Group, or by vendors such as Sun Microsystems or Netscape Communications.
- Applications that are comprehensive because of being built using a broad selection of core tools, technologies, and support services.
Visual FoxPro brings unique strengths to the Visual Tools family, such as:
- An object-oriented tool set for creating reusable components.
- A data-centric tool set with a strong local database engine and client/server orientation.
- A powerful, interactive data manipulation environment.
The Visual Tools family is evolving into a world of more shared components and tools, where a high degree of interoperability prevails and where applications that take advantage of the strengths of multiple tools will become commonplace. Visual FoxPro version 5.0 takes a major step for developers toward this future because it supports ActiveX Controls and creation of Automation servers, and includes other interoperability, extensibility, and connectivity enhancements.
Database Trends
The key trends in the database arena are:
- Rapid adoption of intranet and Internet technologies and deployment models, such as browser/server. Chief information officers demand migration of database applications to new Web-based architectures, which means collecting data from the Web, updating existing data, and leveraging existing application logic using browser-based front ends.
- Continued adoption of client/server architectures, including the three-tier client/server model. In this emerging model, middle-tier business objects encapsulate data access functionality with the business rules for the application. This way, businesses can respond quickly as rules change, because the logic containing the rules is built using high-level tools and is centralized.
- Continued demand for distributed data to support remote, disconnected, or intermittently connected offices and travelling workers.
- Increased focus on data warehousing and data mining. Organizations are looking for development tools to build front ends to huge data warehouses. The tools must summarize and analyze the information, and minimize the impact on over-burdened network infrastructure.
- Continued demand for greater developer productivity and coordination of developer teams.
- Continued demand for very fast access to data.
Using Visual FoxPro version 5.0, a developer can accommodate these trends and develop solutions that address today's database requirements.
Internet Support in Visual FoxPro Version 5.0
Visual FoxPro version 5.0 supports the Internet. Developers can:
- Use ActiveX Controls to add Internet functionality by building Web browsing and FTP file transfer logic into applications, and by creating subclasses of ActiveX Controls. For details, see "Build Forms with ActiveX Controls" and "Extend ActiveX Controls."
- Deploy Visual FoxPro Applications on Internet servers. With this release, Visual FoxPro applications can be built as Automation servers, deployed on an intranet or Internet server, to provide database services to Web browser-based client computers. For details, see "Deploying Applications on the Internet" and "Understanding Visual FoxPro as a Web Search Engine."
- Use the Internet Search Wizard. The Internet Search Wizard is a Microsoft Visual FoxPro wizard that constructs an HTML document (.htm file) as its output, so a developer can query Visual FoxPro data with a Web browser. For more information, read "The Visual FoxPro 5.0 Internet Search Wizard".
Visual FoxPro and Its Competitors
Microsoft Visual FoxPro is a professional developer's database tool, at the complex end of desktop database tools and in the rapid application development and object-oriented programming tools markets. Competitive products include Borland Delphi and dBASE; Corel Paradox; Sybase PowerBuilder, Oracle PowerObjects, and others. Visual FoxPro is mature, powerful, and delivers more for your money when compared to these competitive products. As Visual FoxPro evolves into the shared components and tools model, its focus in this release is on extensibility and interoperability, rather than on addressing specific competitive issues.
Based on feedback from the database community, we concentrated on four areas as we developed Visual FoxPro version 5.0.
ActiveX Extensibility and Interoperability
The number one design goal for Visual FoxPro version 5.0 was to extend the potential uses of an application based on it, and deepen integration with other Microsoft® tools and technologies. By including ActiveX Controls, with their inherent extensibility and interoperability, a developer can extend Visual FoxPro applications. By creating ActiveX Automation servers, a developer can extend Visual FoxPro applications to work with Microsoft Office solutions, other Internet-based applications, and so forth. A developer can broaden the environment in which an application is used, exploit advanced multi-tier client/server architectures, and create reusable application components for more efficient development.
Increased Performance
Developers using FoxPro expect the highest levels of performance from their tools. Visual FoxPro version 3.0 focused on an object-oriented paradigm for application development. Visual FoxPro version 5.0 hones performance under this paradigm by delivering faster local data retrieval and by continuing its leadership in the speed of retrieving server-based data. Form-load and refresh performance is improved, so a developer can build applications that are more responsive to the user.
Improved Connectivity Features
Developers frequently implement FoxPro applications into distributed environments, some with remote offices and mobile users. Using Visual FoxPro version 5.0 Offline View, developers can create applications that run against data on a connected network or against an offline view of the data on their local machines. A developer includes one line of code to switch the view from connected to offline. Visual FoxPro now includes commands that can be used to create programs that synchornize the data and resolve conflicting updates when the user reconnects to the network. In addition, a developer can deploy applications built using Visual FoxPro version 5.0 on Internet servers with front ends that run using a Web browser. This architecture supports mixed client computer environments as well as environments where minimal hardware and software are available on client computers.
Enhanced Development Environment
A developer saves time and money on typical programming chores, because faster and more efficient team development is possible using Visual FoxPro version 5.0. It includes integration of the Visual SourceSafe project-oriented team development system, and a multi-user database container. In addition, improvements have been made to the program editor, and a new debugger has been added.
ActiveX Controls (formerly known as OLE controls) are reusable 32-bit components, available from a variety of sources, which easily add unique functionality to an application with a minimum of additional code. ActiveX is a set of open technologies that builds on the power and flexibility of OLE. ActiveX combines desktop and Web technologies for unprecedented connectivity and functionality. Because ActiveX is an open standard, a developer can choose from a wide range of language tools, applications, and reusable components to build rich, interactive applications quickly and easily. When developing with ActiveX Controls, applications go beyond static documents to provide users with a new generation of dynamic and useful interactions.
In Visual FoxPro version 5.0, ActiveX support includes controls and ActiveX Automation, which a developer uses to expose application functionality via public properties and methods to any other application that supports COM. Then, if desired, this functionality can be easily manipulated.
Including ActiveX technologies in Visual FoxPro version 5.0 means Microsoft has extended its potential for rapid application development and tight integration with other Windows-based tools and applications.
Empower Other Applications with Visual FoxPro
With Microsoft Visual FoxPro version 5.0, a developer can create Automation servers (formerly known as OLE automation servers or OLE servers). An Automation server is an application that exposes functionality that can be used and reused by other applications, including Web sites, through automation. A developer can create an Automation server that displays reusable forms, implements business rules, or packages a complex routine into a simple component that other programmers can use. Creating Automation servers is central to the creation of multi-tier client/server applications.
Microsoft Excel is a simple example of an Automation server. Microsoft Excel exposes objects such as worksheets and charts. Using Visual FoxPro version 5.0, a developer can send data to Microsoft Excel and create a chart. Developers need not know the details of creating a chart; instead, they simply create an instance of the object, set properties, and execute a method to create the chart.
In Visual FoxPro version 5.0, the application developer can choose to expose any object and method from an application as a public class. An example would be a server application that takes client ID as input and then searches several different databases to find and return the client computer name, address, and so forth. Another example is a print server computer that waits for a report name and then processes and prints the report, freeing the client computer for other tasks.
Here is a code example where the Person class exposes the GetName method. The properties FirstName and LastName are set first and then the GetName method is called to return a concatenated string, indicating the proper name.
DEFINE class person AS CUSTOM OLEPUBLIC
FirstName = SPACE(30)
LastName = SPACE(45)
PROCEDURE GetName
RETURN This.FirstName + " " + This.LastName
ENDPROC
ENDDEFINE
This business object can be used from within the Visual FoxPro version 5.0 application or from any application that supports ActiveX Automation, including any from Microsoft Office, Visual Basic, or others. The following sample code could be run from Visual Basic to instantiate the Person object, set the variables, and call the GetName method:
Set oTest = CreateObject("foxole.person")
With oTest
.FirstName = "David"
.LastName = "Lazar"
End With
cName$ = oTest.GetName()
Should business needs change--for example the business decides that names should always be printed in the formal order of LastName, FirstName--then this single object could be updated with new logic and all applications that reference this code would be updated to follow the new business guideline for names.
Build Multi-tier Applications
Remote automation is a new feature for Visual FoxPro version 5.0. Using remote automation, a developer can run an Automation server on one computer and a client application on a separate computer on the network. This feature is useful for implementing three-tier client/server applications, asynchronous processing, offloading work to underused machines, and reducing client software maintenance.
If a developer knows the three-tier approach as implemented in Visual Basic, then this will be familiar.
In Figure 1, the Remote Automation Connection Manager (RACMAN), a utility provided with Visual FoxPro version 5.0, is being used to move an existing Automation server application to a remote Windows NT® server computer. After this utility is run, the operating system routes a call from any client application to that Automation server application to the remote computer. Visual FoxPro version 5.0 provides tools to create remote servers, to distribute client applications that call remote servers, and to maintain applications that use remote automation.
Build Forms with ActiveX Controls
Developers using Visual FoxPro can take advantage of more than 2,000 pre-built controls that are available from independent vendors for extending and enhancing applications. Using ActiveX Controls is a development strategy that speeds development and simplifies application maintenance. Most of the ActiveX Controls available today are supported in Visual FoxPro version 5.0, including controls that use the ISimpleFrame interface.
A developer uses ISimpleFrame support in order to use container controls on a Visual FoxPro form. Container controls can contain other controls. For example, a tab control sets up several different pages onto which the developer can insert native FoxPro controls or other ActiveX Controls to build an application.
Extend ActiveX Controls
Using Visual FoxPro, a developer can create and re-use classes that provide common functions; for example, the VCR class that provides next, previous, first, and last buttons that work in any database (named VCR after the tape player technology). A developer can make changes to the class that are then automatically inherited by all instances of the class. Or by using polymorphism, an instance of the class can be made to function slightly differently in one application while retaining the same general functionality. This makes it easy to build and maintain applications in less time. For a complete discussion of the object-oriented features in Visual FoxPro version 5.0, see "Microsoft Visual FoxPro 3.0 Reviewer's Guide"
A class definition can include ActiveX Controls, giving added power to classes in Visual FoxPro version 5.0. In
Figure 2, an orders class is being created that uses an ActiveX tab control and several Visual FoxPro version 5.0 native controls, including the grid control.
Based on customer feedback, developers using Visual FoxPro have been waiting for this kind of fine-grained control over reusable objects. The class definition can set properties and methods for the ActiveX Control, modifying its default behaviors so that each instance of the class provides the exact behavior the developer wants.
Visual FoxPro customers have told us that speed is their number one concern. Visual FoxPro version 5.0 emphasizes speed in three areas: object performance, memory efficiency, and data retrieval. We designed version 5.0 to be faster than version 3.0 in as many measures as possible. As a result, speed improvements range from 10 to 300 percent, with the greatest gains being realizable on Intel 486 computers with 8MB of RAM.
Object Performance
Form-load and form-refresh time represent critical factors in determining a user's perception of application performance. We addressed the speed with which objects render or are painted on the screen, the speed with which form controls are bound to underlying data, and the size of the memory footprint for several commonly used controls. The result is a 40 to 200 percent improvement in form performance, depending on computer configuration.
Rendering objects more quickly is easy to understand. Binding is not as obvious. In Visual FoxPro version 5.0, we implemented a technique called delayed binding so a developer can speed the form-load process. A developer can choose to open the form with all controls instantiated but unbound. The form loads faster than it did in version 3.0. Visual FoxPro and completes the binding logic while the user is getting their bearings on the open form or while they input a key to locate the desired record set. This technique is well-known to client/server application developers. It breaks up and distributes necessary delays into smaller, more comfortable chunks, and eliminates some unnecessary steps altogether. For example, on a form with a Tab control, data binding is not completed until the user clicks the desired tab.
Memory Efficiency for Form Controls
Reducing the memory footprint on several form controls contributes to improvements for forms' performance. The text box, list box, and combo box controls have smaller memory footprints. Visual FoxPro version 5.0 forms that use these controls require less memory to load and run than did those same forms in version 3.0. For example, open a list box or combo box bound to a table with 1,000 or more rows, and compare the form's performance between versions 3.0 and 5.0. In version 3.0, a user experiences delays when scrolling. In version 5.0, a user can scroll freely and see screen refreshes while scrolling. In version 3.0, the screen refresh occurs only after the mouse button is released.
Data Retrieval Speed
Data retrieval speed is traditionally where users experience database performance, as raw data access.
We made performance gains adding support for ANSI-compliant joins. Previous versions of FoxPro used the WHERE clause to establish join conditions. Visual FoxPro version 5.0 uses the ANSI approach. For example:
SELECT Customer.company_name, Orders.order_id,
Orders.order_date;
FROM tastrade!customer INNER JOIN tastrade!orders ;
ON Customer.customer_id = Orders.customer_id;
WHERE Customer.country = "US"
In this example, we are joining two tables and selecting three fields. The join occurs in the FROM clause instead of in the WHERE clause. Aside from being consistent with Microsoft Access, Microsoft SQL Server, and other ANSI-compliant approaches, this method yields faster results. For developers moving from previous versions, the Query Designer automatically converts queries to the new syntax. The Query Designer also creates ANSI-style joins by default, so developers can learn the new syntax as they build new queries.
In response to developers who seek more flexible deployment, we designed a variety of connectivity options in version 5.0 to satisfy a broad range of requirements. For example, business are becoming more complex, by converting client/server applications to Web-based applications, and becoming more distributed, with remote offices, mobile users, and telecommuters.
We made two fundamental improvements to the Visual FoxPro architecture. First, in terms of connectivity at the engine level, version 5.0 includes support for Offline Views, to support remote users in their use of applications that support synchronization of data. Second, in terms of connectivity on the front end, version 5.0 includes support for deploying Visual FoxPro Automation servers on the Internet. These two improvements offer a range of new choices for deploying database applications.
Offline Views
There are times when a developer wants to display, collect, or modify data independently of the host database. By using the new offline view features in Visual FoxPro, the developer can use views to connect to a host database, either a Visual FoxPro database or an ODBC-connected server, and to create a subset of data for use by the offline user. Then, working offline, the user can use the view directly or through an application the developer writes. When the user has updated the data, the developer's code, written to upload changes stored in the view to the host database, is invoked.
Some scenarios where offline views can be useful include:
- Where large databases are maintained centrally on MIS servers, sometimes called data warehousing. The developer who is only interested in marketing-department data, for example, can construct a view including only the relevant data. Then, with the data offline, multiple users in the marketing department update it, later committing the changed data to the source database.
- When traveling with a subset of data on a laptop. Here, a user modifies the data independently of the host database, then later updates the host database with the changed data.
- With time-sensitive data. An example would be updating data reflecting employee pay raises before the changes take effect. A user can work with the offline view, massaging the data, then updating the payroll database when the changes take effect.
Minimal code changes are required to use offline views in Visual FoxPro version 5.0. A developer simply points the application to the offline view instead of the normal data view, and then all fields, indexes, tables, forms, and so forth are accessible using the same names. A developer implementing an offline view writes the code to create the offline view using the CreateOffline function, then writes a single line of code to switch between views, and finally writes code to handle conflicts that may occur if the same row in both views has been updated.
The developer who wants to employ offline views can distribute data closer to the users who need it, offering faster performance while reducing telecommunications costs. Full coverage on using offline views is available in Chapter 8 of the Developer's Guide, which you can find in the Microsoft Visual FoxPro online documentation set.
Deploying Applications on the Internet
Using Visual FoxPro version 5.0 to create Automation servers brings the power of Visual FoxPro to a variety of other applications. A key use for this technology is to deploy Visual FoxPro applications on the World Wide Web.
Imagine a developer building a Web site, or intranet server who wants to make an employee directory available. Ideally, an employee can point a browser to the Search for Employee page, a mockup of which you can review in Figure 3.
To perform a search, an employee types the requested employee's name, phone extension, department, position, or any other information available, then chooses Search Now. In the browser, a list of the employees who meet the search criteria is displayed, from which the employee can choose the person desired.
The beauty of this architecture, when used instead of static HTML pages, is that as soon as the database is updated, it is immediately available to the browser. And there is no latency period for updating an HTML page. Conversely, data collected from the Web goes directly into a database with no need to convert and massage the data, thus saving work for the developer.
Using the FOXISAPI library included with Visual FoxPro version 5.0, a developer can build forms that run on a local network, using the Visual FoxPro runtime, and simultaneously on Web browsers, using HTML-based clients. This enables developers to minimize coding and maintenance chores while supporting both LAN-based and new browser-based clients.
Understanding Visual FoxPro as a Web Search Engine
To use Visual FoxPro as an information server for the Web requires three components:
- A Web server that supports ISAPI (Internet Server API), such as the Microsoft Internet Information Server.
- A Visual FoxPro application that can be called as an Automation server. This application can run on any server accessible to the Web server.
- A means of displaying search results, usually a Web page template into which you insert data.

Figure 4. FoxPro Web server architecture.
For more information about using Visual FoxPro as a Web search engine, see the white paper titled "Custom OLE Servers".
Using Visual FoxPro version 5.0 to develop Web-based applications, a developer using FoxPro can deploy the same easily maintainable application to four different platforms, one that runs:
- From within Visual FoxPro version 5.0.
- As a standalone, executable file.
- As an ActiveX Automation server from any ActiveX Automation controller, such as Microsoft Excel, Microsoft Word, Microsoft Visual Basic, Microsoft Visual FoxPro version 3.0, and so forth.
- From an Internet browser, which can reside on another computer, such as an Intel 386-based PC running MS-DOS®, a Unix computer, an Apple Macintosh computer, or a Personal Digital Assistant.
This combination of connectivity and interoperability gives developers using Visual FoxPro deployment options across a broad range of solutions in almost any computing environment.
Continue to the next section of the Evaluator's Guide.