Frequently Asked Questions for Microsoft Visual FoxPro 6.0 for Windows These are some of the most frequently asked questions about Visual FoxPro. Please scan this list before you call Microsoft Technical Support. To print these notes, choose Print from the File menu. This document is divided into the following four parts: --------------------------------------------------------------------- Part 1. Support and Marketing Part 2. Visual FoxPro 6.0 New Features Part 3. Migration from other version of FoxPro Part 4. Common Visual FoxPro questions --------------------------------------------------------------------- Part 1. Support and Marketing Question 1-1: Where can I find product updates? Answer: The best place to get information on product updates, including Service Packs and updated samples, wizards, and other code, is on the Visual FoxPro Web site at the following URL location: www.microsoft.com/vfoxpro Please check the Web site on a regular basis to download the latest updates. Question 1-2: Where can I go for more information about Visual FoxPro? Answer: The best way to keep abreast of all new product announcements is through the Microsoft Visual FoxPro Web site. In addition to new product announcements, this site also features product updates, technical articles, white papers, cool samples from expert developers, conference announcements, and links to many other FoxPro web sites. Question 1-3: How do I obtain product support and report bugs? Answer: The Microsoft Visual FoxPro Web site has links to a variety of online support options including the extensive Microsoft Knowledge Base of all products. You can also access a list of Frequently Asked Questions. In addition to online support, you can also call for direct product support. The Help menu has an option listing technical support phone numbers. These numbers can also be used to report issues that you think may be product bugs. Question 1-4. What is the Knowledge Base and how do I use it? Answer: The Knowledge Base is an extensive list of articles covering how to use product features, known bugs and their resolution or workarounds, and other useful information to help you use various Microsoft products. The entire Knowledge Base is available online at the following URL location: support.microsoft.com Question 1-5: Will there be a Visual FoxPro 6.0a? Answer: Microsoft is committed to producing high quality products. If the need arises we may provide bug-fixes for Visual FoxPro 6.0. However, these would not be in a 6.0a release. Any bug fixes to Visual FoxPro 6.0 would be included in Visual Studio Service Packs. These would be announced on either the Visual FoxPro www.microsoft.com/vfoxpro or the Visual Studio www.microsoft.com/vstudio Web sites. Question 1-6: Microsoft offers a number of great solutions for developing applications. How do I know which product to use and recommend to my clients? Answer: There are a number of factors that go into choosing the right product for a job. The Microsoft Visual FoxPro web site contains an excellent strategy backgrounder paper describing the differences between Microsoft products like Visual FoxPro, Visual Basic, SQL Server, and Access. Question 1-7: Where do I find samples using Visual FoxPro? Answer: Visual FoxPro 6.0 ships with an extensive collection of samples including a number of new ones for 6.0 specific features. Unlike prior versions of Visual FoxPro, the samples are now installed in a location for all Visual Studio samples. You must choose to install the samples by running a Custom setup. In Visual FoxPro, use the new HOME(2) function to easily find the location of the samples you chose to install. In addition to shipping samples, the Microsoft Visual FoxPro web is frequently updated with new samples. Question 1-8: Many times I will read an article on the Microsoft web site and see sample code for Visual Basic and Visual C++. Does this mean I can not use Visual FoxPro? Answer: No. Particularly when it comes to calling and using objects, the syntax in Visual Basic and Visual FoxPro is almost identical. You can usually take Visual Basic code and quickly change it into the correct syntax for Visual FoxPro. The similarity in syntax also means that, often, the code in a Visual Basic book or magazine is highly useful to Visual FoxPro developers. Question 1-9: I've been using Visual FoxPro for years? Why should I upgrade to Visual Studio? Answer: Microsoft Visual Studio is the ultimate application development solution for professional developers. As application development becomes more focused on component-based systems that integrate client/server and the Internet, it is necessary to have a wealth of tools that meet the demands of today's developer and the changing needs of businesses. Microsoft Visual Studio offers a complete set of tools for the professional developer. Visual Studio Professional Edition includes Visual FoxPro, Visual Basic, Visual C++, Visual J++, and Visual InterDev. Visual Studio Enterprise Edition includes those five tools plus Visual SourceSafe and SQL Server. Question 1-10: How can I obtain additional marketing related information as well as requesting participation in future betas of Visual FoxPro? Answer: Send mail to the following email address: foxmktg@microsoft.com There is no guarantee that you will be selected as a beta participant since the number of people requesting to be on the beta often exceeds the number of available slots. --------------------------------------------------------------------- Part 2. Visual FoxPro 6.0 New Features Question 2-1: What's new in Visual FoxPro 6.0? Answer: There are many exciting new features in version 6.0. These include custom Automation server improvements, Active Documents, OLE Drag and Drop support, Access and Assign methods, and the Component Gallery to name just a few. For more information on new features and new language, click "What's New" on the Visual FoxPro Start Page in the MSDN Library browser. Question 2-2: What is an Active Document and when should I use it? How does it differ from Active Documents in Visual Basic? Answer: Active Documents are a way of deploying your Visual FoxPro applications on the intranet. You can use Active Documents to run forms created with Visual FoxPro, containing Visual FoxPro code, directly in the Microsoft Internet Explorer web browser. In Visual Basic, Active Documents are merely forms that have been modified slightly to support features specific to Internet Explorer. Active Documents in Visual FoxPro are slightly different. The ActiveDoc class is a non-visual class that acts more like an application object handling events necessary to run existing Visual FoxPro forms in the browser. Therefore, the conversion of forms is not necessary. Several new properties including form ScrollBars and TitleBar properties were added to conform to user interface standards when hosted in Internet Explorer. It is important to understand that the Visual FoxPro ActiveDoc you run in Internet Explorer is merely an application (.app) file that could be run directly within Visual FoxPro. Because of this, the run-time version of Visual FoxPro is required. Therefore, Active Documents are more suitable for intranet environments where constraints of downloading the large Visual FoxPro run-time files are not as severe as over the Internet where most users use modems to gain access. The good news is that the run-time files need to be downloaded only once. Question 2-3: What is the difference between OLE Drag and Drop, and the Drag and Drop that existed in Visual FoxPro 5.0? Answer: Prior to this version, Visual FoxPro supported Drag and Drop between forms and controls on these forms. This type of Drag and Drop was proprietary to Visual FoxPro, which meant that you could not drag to and from other non Visual FoxPro applications. With this version, Visual FoxPro now supports true OLE Drag and Drop, which is the same type of Drag and Drop used by other Windows-based applications. Your applications can now use this standard to support drag and drop of data between other applications such as Microsoft Excel and Word. Question 2-4: Why are there two application wizards? Answer: In an effort to simplify application development for Visual FoxPro developers, many new features were added to version 6.0 including a new Application Framework, Application Builder, and Component Gallery. The older Application Wizard that shipped with version 5.0 is included for backward compatibility. The newer wizard, which simply asks for a project name and location, simplifies the entire application creation process. Question 2-5: What is the difference between a Project object and a ProjectHook object? Answer: Whenever a project (.pjx) file is opened, a Project object is created. This project can be referenced with the following code: _VFP.ActiveProject The Project object has properties for all the information available in the Project Information dialog box, including Collections for files and servers. Because developers want to interact with various events associated with a project, such as adding files or doing builds, it was necessary to create a new class (ProjectHook) to support code for these events. ProjectHook classes are optional for a project. If a ProjectHook class is specified for a project (as specified in the Project Information dialog box), it is instantiated when the project is opened (this includes commands such as BUILD APP), and destroyed when the project is closed. Question 2-6: How can I add check boxes in my ListBox control? Answer: A commonly requested enhancement has been to add check box support to the Visual FoxPro native ListBox control. The new version of the Microsoft ActiveX ListView control as well as the Treeview control now support check boxes. These controls ship with Visual FoxPro 6.0 (see Question 2-7). Question 2-7: My Visual FoxPro 5.0 forms containing certain controls such as ListView or TreeView do not inherit the latest features of these controls (such as check box support). Distributed applications with these forms do not function correctly on end-user machines because of an OLE error with the form. Answer: In version 6.0, the file containing the following ActiveX controls was renamed from Comctl32.ocx to Mscomctl.ocx: Microsoft ListView Control Microsoft TreeView Control Microsoft ImageList Control Microsoft ProgressBar Control Microsoft StatusBar Control Microsoft Slider Control Microsoft Tabstrip Control Microsoft Toolbar Control Even though Visual FoxPro 6.0 upgrades to the new Mscomctl.ocx file, older version 5.0 forms with these controls will still reference the older file since the ActiveX control is bound by its OleClass property. ActiveX controls from the older Comctl32.ocx file have a version of 1. For example, the OleClass property for a ListView control on a 5.0 form would say: COMCTL.ListViewCtrl.1 Newer ActiveX controls in the Mscomctl.ocx file have a version 2 (or higher). For example: COMCTL.TreeViewCtrl.2 Visual FoxPro will not automatically upgrade your control, so it is important to know which version of an ActiveX control a form uses when distributing your applications. Question 2-8: Can I create my own user-defined Collections in Visual FoxPro 6.0? Answer: Visual FoxPro 5.0 did not directly support the creation of Collections, which are similar to arrays of objects. The Form object's Controls property is an example of a collection. Visual FoxPro 6.0 supports Access/Assign methods that can be used to create real user-defined Collections. There is an excellent example of this in the Solutions sample application. Question 2-9: Why don't my Visual FoxPro 5.0 Automation servers work with Microsoft Transaction Server or Active Server Pages? Answer: A number of server improvements were made in version 6.0, including support for apartment-model threading to make servers scale better and run smoother in Active Server Pages and Transaction Server. Type library improvements now allow applications such as Visual Basic to see properties and methods in command completion dropdowns. You may also experience a Remote Procedure Call error using the Visual FoxPro 6.0 or 5.0 Automation servers with Microsoft Transaction Server 2.0. If this happens, make sure you have at least Service Pack 1 or higher of Transaction Server 2.0. Question 2-10: I want to write an Internet application using Visual FoxPro 6.0. There are a lot of new features for doing this. Where do I start? Answer: Visual FoxPro provides a variety of tools that you can use for creating applications to deploy over the Web. The new Web Publishing Wizard and GENHTML features are excellent tools for generating a variety of HTML output to publish your Visual FoxPro data. Depending on your needs, there are options for generating both static and dynamic HTML. You can even use the Web Publishing Wizard to generate a script that can be executed at runtime to regenerate your HTML. Visual FoxPro also supports the creation of COM components (formerly known as Automation servers) that can be used as middle-tier objects in a web application. These objects can be deployed to access and process Visual FoxPro data natively, through ODBC or ADO as well as handling business rules. Visual FoxPro COM components can be accessed directly within Active Server Pages and Microsoft Transaction Server. You can also use the FOXISAPI extension that ships with Visual FoxPro. This extension can be called by Microsoft Internet Information Server to request HTML from a Visual FoxPro COM component by invoking a method that returns the HTML directly. The new Active Document technology is another option that allows you to take existing Visual FoxPro forms and run them over an Intranet setting. Because the Visual FoxPro runtime is required, it is not always ideal to deploy over the Internet. Question 2-11: Why does the new Scrollbars property for forms not display scroll bars on my form when I change this property at runtime? Answer: Before a form is created, Visual FoxPro reads the form's Scrollbars property setting because the value of this property determines how a form is created. If the value of the Scrollbars property is 0 (no scroll bars), Visual FoxPro creates a Visual FoxPro 5.0 style light-weight form. If the value of the Scrollbars property is a value other than 0, Visual FoxPro creates a form that consumes more memory. When designing your applications, keep in mind that forms with scroll bars require more memory. If the Scrollbars property is set to 0 at design time, the Scrollbars property at runtime is read-only because Visual FoxPro initially creates a light-weight form. However, if the Scrollbars property is set to a value other that 0 at design time, Visual FoxPro allows the Scrollbars property to be read-write at runtime because there may be code that calls the SAVEAS() function to create a new form with scroll bars. If you have no need for scroll bars on a form (for example, the form uses page frames), then set the Scrollbars property to 0 at runtime to save memory. If the Scrollbars property is set to a value other than 0 at design-time, you can change the value of the Scrollbars property at runtime. However, if you change the value of the Scrollbars property to 0, Visual FoxPro hides the scroll bars on the form; a new light-weight form isn't created. --------------------------------------------------------------------- Part 3. Migration from other versions of FoxPro and Visual FoxPro Question 3-1: What should I be concerned about when moving my Visual FoxPro 5.0 applications to Visual FoxPro 6.0? Answer: Visual FoxPro 5.0 applications will run as is directly in Visual FoxPro 6.0. If the code in your 5.0 application contains any references to system menu pads and bars (like _msystem), you must recompile the code. You can also create applications in 6.0 and run them in 5.0, however, if you do this, your code must not contain any new 6.0 language. Databases can be shared between the two versions. The file format for menu (.mnx) files has been slightly changed to accommodate new ActiveDoc support. If you try to open a 5.0 menu in 6.0, you will be prompted to convert to the new format. The new menu format will be compatible with 5.0 versions of GENMENU and other XBase utilities that read the .mnx file. However, the Visual FoxPro 5.0 menu designer will not be able to open the 6.0 format. To convert a 6.0 .mnx file back to the 5.0 format, you can use the following command: ALTER TABLE mymenu.mnx ALTER COLUMN location N(1) However, the NEGOTIATE information for menu pads may be lost or corrupted in doing so. Project (.pjx) files are still the same; however, new ProjectHook information is stored in these files. Therefore, if you are using 6.0 projects with ProjectHooks (which are optional), you should avoid opening them in 5.0. Please read the "Upgrading" section in Help. Question 3-2: Why do I have to execute SYS(2333,0) to allow various ActiveX controls to work properly in Visual FoxPro 5.0? Answer: In Visual FoxPro 6.0, the default is now SYS(2333,0) so this is no longer required. It is recommended that _vfp.AutoYield is set to .F. also. Question 3-3: What should I be concerned about when moving my Visual FoxPro 3.0 applications to Visual FoxPro 6.0? Answer: Applications written in Visual FoxPro 3.0 will need to be recompiled to run in Visual FoxPro 6.0 since the object code is not binary compatible between versions. The database (.dbc) file format between 3.0 and 5.0 was changed, so it is not practical to share databases between applications written in 3.0 and 6.0 unless 3.0 users access the data through the Visual FoxPro ODBC driver (using Remote Views). The format for form (.scx) files and class (.vcx) files was modified slightly between 3.0 and 5.0 (see Question 3-5). As in version 5.0, when opening a 3.0 form or class in version 6.0, the Converter is invoked. Project files were updated in version 5.0 to support source control integration. Therefore, 3.0 projects are automatically converted to support source control when opened in version 6.0. See Question 3-1 for more details on changes between menu and project files made between 5.0 and 6.0. Also, please read the "Upgrading" section in Help. Question 3-4: What is the cross-platform strategy for Visual FoxPro? Answer: Please read Question 3-3 above because the current version of Visual FoxPro for Macintosh is 3.0. There are a number of alternative cross-platform solutions for Visual FoxPro for Windows developers that should be seriously evaluated. Consider using Microsoft Internet Explorer for Macintosh as a front-end to your Mac users. Visual FoxPro 6.0 Automation servers can be used to access Fox data and output it as HTML. The FoxISAPI utility (with new pool manager support included with 6.0) is one such solution. Question 3-5: If I edit or run my Visual FoxPro 3.0 forms in Visual FoxPro 6.0, the fonts are smaller and no longer appear bold. Why does this happen and how can I avoid this? Answer: To enable you to more easily make forms that comply with the Windows 95 standard, several default property settings for controls were changed, including FontSize, FontBold, and ColorSource. If these were set to default values under Visual FoxPro 3.0, they will remain defaults under Visual FoxPro 6.0. However, because the defaults are different, text will be displayed differently. If you want to have your forms appear as they did in Visual FoxPro 3.0, convert them as part of a project. Then when you open the Visual FoxPro 3.0 project in Visual FoxPro 6.0, check the Retain Visual FoxPro 3.0 Default Property Values check box in the Converter. Question 3-6: What should I be concerned about when moving my FoxPro 2.x applications to Visual FoxPro 6.0? Answer: Visual FoxPro 3.0 was a major upgrade for FoxPro developers. In fact, because of the paradigm shift (see Question 3-7), some people consider Visual FoxPro an entirely new product. Because of the new object-oriented shift, most of the file formats were changed. Visual FoxPro ships with a Converter utility that handles all file format changes. However, it does not convert your procedural code to object-oriented code except for visual user interface items. It is important to know that your existing FoxPro 2.x code will still run as is. We do recommend that you migrate your source to object-oriented code where possible to take advantage of many new features as well as more efficient development practices. One of the popular new features of Visual FoxPro is support for real databases (as a collection of tables). The term "database" was often used interchangeably with "table" in FoxPro 2.x and prior versions. Please read the "Upgrading" section in Help. Question 3-7: When should I use object-oriented programming (OOP) instead of procedural programming? Is it better to create classes visually or through program code? Answer: You can continue to use a traditional procedural programming style in Visual FoxPro if you prefer it. Most FoxPro version 2.x programs coded in procedural style will run with only minor modifications in Visual FoxPro. However, consider making the transition to an OOP programming style if the following conditions are true: 1. Your organization currently participates in a structured, analytical process for new programming projects. 2. You are willing to invest the resources necessary to develop a library of reusable code, without realizing full payback on this investment until after the current project. 3. You want to tap the power of Visual FoxPro event handling, common code syntax, and other benefits associated with OOP. When you create a class programmatically, you must know all of the commands necessary to complete a task, but you can also inspect any portion of code at any time. If you create a class visually, you do not need to know all of the commands to complete a task, but you must look at each method individually. One of the benefits of Visual FoxPro is the ability to add a class defined through code to a form, save the instantiated objects as a class, and then edit those classes visually. This functionality, combined with the ability to export code through the Class Browser, provides the best of both types of class design tools. Question 3-8: My client's data needs have expanded. How can I move my Visual FoxPro data to Microsoft SQL Server? Answer: Visual FoxPro ships with an Upsizing Wizard that moves FoxPro databases to SQL Server or Oracle. The Wizard has options to automatically create remote views in your database that access the new SQL Server data. This strategy allows you to retain existing forms and reports that access data sources with little or no modification. Question 3-9: Why is there a new Mscomctl.ocx file? Do I still need a new Comctl32.ocx file? What are some potential issues? Answer: The Visual FoxPro 5.0 Comctl32.ocx file contains the following ActiveX controls: Treeview Listview Slider Imagelist Status Bar Tabstrip Progress Bar Toolbar With Visual FoxPro 6.0, updated versions of these controls are being released in the new Mscomctl.ocx file. This was done primarily because a number of new features were added to these controls such as checkbox and hover support. The following issues are important to Visual FoxPro developers: - Visual FoxPro does not automatically update ActiveX controls on forms to use the newer version. So, existing forms that use controls such as the Treeview control will still reference the old Comctl32.ocx file. - Once a control is added to a form, you cannot update or change the version. This is done intentionally so that newer ActiveX control versions do not break code if for some reason the newer version was not backward compatible. - You can determine which version of a control you have by viewing the OleClass property of that control in the Properties window. For example: COMCTL.ListViewCtl.1 (newer Comctl32.ocx version) COMCTL.ListViewCtl.2 (newer Mscomctl.ocx version) - It is critical that you know which version of a control your forms use for distribution purposes. If all your forms use the older Listview control, you wouldn't want to ship the new Mscomctl.ocx file. The Setup Wizard lets you select the particular file to include with your distributed applications. - Another important issue for developers who have both Comctl32.ocx and Mscomctl.ocx controls installed and registered on a single machine, is to ensure that the Mscomctl.ocx is always registered last. When you add an ActiveX control to a form, the Insert Object dialog box displays a list of controls. It is possible that the dialog box does not display the latest versions of these controls. The current version is not always the latest version, but rather the last one registered. So, if by chance you register Comctl32.ocx after installing Visual FoxPro, you can easily reset the Mscomctl.ocx file as the current one by running Regsvr32.exe from the Windows Start menu -> Run dialog box. For example, run: REGSVR32 c:\Windows\System\Mscomctl.ocx This ensures that you are always installing the latest version of these ActiveX controls. --------------------------------------------------------------------- Part 4. Common Visual FoxPro questions Question 4-1: How do I hide the Visual FoxPro desktop when my application's .exe file starts? Answer: Put the following line in the Config.fpw configuration file: SCREEN=OFF Note: If you do not need to provide the Config.fpw as a separate file-- that is, you will not need to be making any changes to it after building the .exe--you can add the Config.fpw file to the project, making sure it is marked as included, and it will be built as part of the .exe. Visual FoxPro will not hide the desktop unless there is a top-level form active. You can also programmatically hide the desktop with the following command (assuming that a top-level form is already active): _VFP.Visible = .F. Question 4-2: How do I create a top-level form with a top-level menu? Answer: To create a top-level form, set the form's ShowWindow property to 2-As Top Level Form. To create a top-level menu, open the Menu Designer. From the View menu, choose General Options, then select the Top-Level Form check box. To place the top-level menu in the top-level form, you must place code in the Init (or other) event of the form. For example: DO