Developing Windows 95 Applications in Visual FoxPro

Randy Brown
Microsoft Corporation

Updated January 1997

Because Microsoft® Visual FoxPro™ 5.0 is certified as a Windows® 95-compatible development environment, you can use it to create applications that qualify for the Windows 95 Compatibility Seal, as well as the Office 95 Compatibility Seal. See these sections for details.

Note for Visual FoxPro 5.0 users:

Visual FoxPro 5.0 improves many of the areas mentioned below for obtaining the Windows 95 Compatibility Seal.

Developers no longer need to have special code to handle issues mentioned in the System Metrics section below. New settings on the ColorSource property of a control automatically handle this for you.

The Visual FoxPro 5.0 Setup Wizard handles Seal requirements automatically for uninstalls.

Qualifying for the Windows 95 Logo

To make your application qualify as Windows 95 Compatible, it must conform to the following guidelines:

Created or Compiled in 32-Bit Mode

The application must be either a Win32 application programming interface executable, compiled with a 32-bit compiler that generates an executable of the PE (Portable Executable) format, or the application must have been created by an application or tool that satisfies the Windows 95 logo requirements and creates 32-bit Windows-based applications. For example, an application written in the 32-bit version of Visual FoxPro would fall into the latter category, because the resulting applications are not necessarily executables.

Contains UI/Shell Support

The application must have UI/Shell support. To conform to The Windows Interface Guidelines for Software Design, this means:

Note   You can find The Windows Interface Guidelines for Software Design at http://www.microsoft.com/win32dev/uiguide/

Functions Under Windows NT

The application must run under Windows NT 3.51 or Windows NT 4.0 and degrade gracefully with any Windows 95-specific functionality under Windows NT or any Windows NT-specific functionality under Windows 95.

Uses Long File Names

The application must use long file names. This includes:

Accounts for Plug and Play

Plug and Play awareness is recommended but not required.

The following requirements are also necessary for applications that work with files:

Specific Techniques for Visual FoxPro Applications

To create a Windows 95-compatible application in Visual FoxPro, use these techniques and guidelines:

User Interface Guidelines

Registering File Icons

The Project Info dialog contains an option to select a particular .ICO file to attach to a project. When a project is compiled and built, the resulting .APP or .EXE file will contain the .ICO file. This file must register both 16x16 and 32x32 pixel icons.

You can also use the _SCREEN.ICON property to set the icon displayed in the title bar and task bar.

Handling Long File Names

You must ensure that your code supports long file names. Visual FoxPro will not handle this automatically for you. The file name can include the path name which should be in the UNC format:

\\Server\Share\Directory\....\FileName

With long file name support in Windows 95 and Windows NT, folks can now include spaces and periods in their files. This can potentially break code which is heavily reliant on the old DOS naming conventions of an eight character or less name followed by a three character extension.

The Visual FoxPro native file dialogs will handle much of the work for you; there are, however, situations where you can get yourself in trouble. The following example illustrates this point.

SET RESOURCE TO “MY BIG FOXUSER.DBF”
myrezfile = SYS(2005)
SET RESOURCE TO FOXUSER
SET RESOURCE TO &myrezfile        && fails

In order for the example above to work, you need to place quotes around the file name.

myrezfile = “SYS(2005)”

If you are using file names with normal Visual FoxPro commands, it is imperative that you always put quotes around the file name. Macintosh developers are already aware of this issue, but many Windows developers never had to deal with file names containing spaces.

Another point to consider is that a valid file name can have multiple periods inside it, so don’t rely on simply using ATC( ) to search for a period to derive an extension. In addition, file names no longer need to contain an extension, although it is a good idea to retain them for Visual FoxPro.

COPY TO "Fred's . Big . Barn.DBF"

The SET VOLUME command is a great command to use to easily maintain long path names of commonly used locations. Macintosh developers have been using this command for quite some time now, and because paths play such a major role today, it is easier to manage them using volume settings. The following example shows how you can set a volume reference to your old FoxPro® for Windows 2.6 directory.

SET VOLUME x TO e:\\fpw26\
MODIFY COMMAND x:genscrn

OLE Support

Applications must have OLE Container and/or Object support and OLE drag/drop support. The recommendation (not a requirement) is for the application to have OLE compound file support with doc file summary information and OLE automation support.

If you have no intention of using OLE in your custom applications, this can be an onerous requirement just to get the Windows 95 seal. You can meet this requirement by including an OLE object in your application which supports drag and drop. For example, if your application includes a form with a Microsoft Excel pivot table, your users will be able to drag and drop from that pivot table to Word documents. As ActiveX controls that support drag and drop become available there will be more options for including drag and drop in your applications.

Simple Mail

Visual FoxPro has three options for implementing mail support:

The following KB articles offer advice on using MAPI with Visual FoxPro.

The MAPI and SAPI API’s are different on 16-bit operating systems and on 32-bit operating systems. The Send option is available and works on both. The MAPI ActiveX controls (OCXs) only support 32-bit operating systems. There are new FOXMAPI.FLLs available on CompuServe for both platforms.

Although it is not recommended, many customers are using 16-bit mail applications under Windows 95. Both the Send option and the MAPI ActiveX controls will not work with this configuration.

Here are some of the more common mail support questions brought up to PSS and documented in KB articles.

Q135521: Send Does Not Work Under Windows 95 or Windows NT

If 16-bit Microsoft Mail is used on a 32-bit operating system such as Windows 95 or Windows NT, various MAPI errors occur when trying to use the File Send Command in Visual FoxPro. These same errors also occur when using the MAPIsession and MAPImessage ActiveX controls from within a Visual FoxPro Application. MAPI is finding the 32-bit version of MAPI.DLL and trying to load the 32-bit mail client software. When using a MAPI session and message ActiveX controls under Windows 95 or Windows NT, you must use the 32-bit mail client that is supplied with these products.

Q128816: Cannot Access MAPI Under Win32s

MAPI custom controls do not do anything with Visual FoxPro running under Win32s. In addition, no error messages are displayed when you use the MAPI custom controls. Due to a missing layer between 32-bit applications and the 16-bit MAPI DLLs, FoxPro (a 32-bit application) cannot communicate with the MAPI ActiveX custom controls under Win32s.

For an example of how to create a simple messaging form that can send Visual FoxPro data to an e-mail address, search for “Send Mail” in Solution.hlp located in the Visual FoxPro SAMPLES\SOLUTION directory.

Qualifying for the Office 95 Logo

The Office 95 logo identifies applications that are easy for Office users to learn, because they have menus and toolbars consistent with the Office 95 applications. In addition to Windows 95 compatibility, which is mandatory, your application must have the following requirements to be compatible with Office 95:

Standard Toolbar

Feature Requirement
Location, Size & Appearance of Bar Mandatory
Small-Format Buttons (default) Mandatory
Large-Format Buttons Mandatory
Color Buttons (default) Mandatory
B-&-W Buttons Mandatory
ToolTips Mandatory
"View->Toolbar" Dialog Box Mandatory

Toolbar Buttons

Feature Requirement
New Mandatory
Open Mandatory
Save Mandatory
Separator Space Mandatory
Print Mandatory
Print Preview If Supported
Spelling Check If Supported
Separator Space Mandatory
Cut Mandatory
Copy Mandatory
Paste Mandatory
Paint If Supported
Separator Space Mandatory
Undo If Supported
Redo If Supported
Separator Space If Supported
Application Specific If Supported
Separator Space If Supported
Zoom Control If Supported
Separator Space If Supported
Help Button Mandatory

Main Menu

Feature Requirement
File Mandatory
Edit Mandatory
View If Supported
Insert If Supported
Format If Supported
Tools If Supported
Application Specific If Supported
Window If Supported
Help Mandatory

File Menu

Feature Requirement
New Mandatory
Open Mandatory
Close Mandatory
Separator Bar Mandatory
Save Mandatory
Save As Mandatory
Separator Bar Mandatory
Page Setup If Supported
Print Preview If Supported
Print Mandatory
Separator Bar Mandatory
Application Specific (Send Mail, etc.) If Supported
Separator If Supported
Most Recently Used List Mandatory
Separator Bar Mandatory
Exit Mandatory

Edit Menu

Feature Requirement
Undo If Supported
Repeat If Supported
Separator Bar If Supported
Cut Mandatory
Copy Mandatory
Paste Mandatory
Paste Special If Supported
Separator Bar Mandatory

Help Menu

Feature Requirement
Contents If Supported
Search for Help On Mandatory
Index If Supported
Separator Bar Mandatory
Tutorial Tools If Supported
Separator Tools If Supported
Technical Support Mandatory
Office Compatible Mandatory
About Mandatory