Microsoft

The Application Compatibility Tool extends the life of your legacy applications

The Application Compatibility Tool is an excellent alternative to VMware when you need to make legacy applications run in Windows 2000. In this Drill Down, Brien Posey walks you through both the GUI and command-line modes.


One of the problems with having so many different versions of Windows is that not every application will work with every version. So what do you do when you need to upgrade to a newer version of Windows but one of your most critical applications won’t run on the new version? Fortunately, you have a choice. There’s VMware, which creates a virtual machine to run legacy apps. But you have a better alternative: the Application Compatibility Tool.

The Application Compatibility Tool, a utility included with Windows 2000, is designed to run legacy applications in a Windows 2000 environment without relying on virtual machines. It overcomes some of the most common issues that prevent an application from running under Windows 2000.

Why VMware?
If you can use the Application Compatibility Tool for free, you’re probably wondering why I mentioned VMware. Well, although the Application Compatibility Tool works well, it isn’t perfect. If the Application Compatibility Tool can’t seem to run the older application, then you’ve got a choice to make. You can give up the legacy application, downgrade to the old version of Windows, or adopt a utility such as VMware.

Installing the Application Compatibility Tool
Although the Application Compatibility Tool is included with Windows 2000, it isn’t installed by default. Instead, the tool is included in the Windows 2000 Support Tools. You can install the Windows 2000 Support Tools by inserting your Windows 2000 CD, navigating to the \Support\Tools directory, and running the Setup.exe program. Once you’ve installed the Windows 2000 Support Tools, you can find the Application Compatibility Tool in the \Program Files\Support Tools folder. You can run the Application Compatibility Tool in either GUI mode or in command-line mode.

Copying Apcompat.exe manually
In the CD’s \Support directory, there is a file named Apcompat.exe. This file is the Application Compatibility Tool. Although the tool is installed as a part of the Windows 2000 Support Tools installation, you can also copy it manually to the hard disk from this location.

GUI mode
You can run the Application Compatibility Tool by entering the Apcompat.exe command at the Run prompt. When you do, Windows will load the utility’s GUI interface, as shown in Figure A.

Figure A
You can use the Application Compatibility Tool to force legacy applications to run in Windows 2000.


Using the Application Compatibility Tool is pretty simple. You first begin by specifying the path and filename of the application that you need to run. You can use the Browse button to make locating the application easier. Once you’ve specified the application, you must specify the operating system the application needs to think it’s running in. Some applications won’t run under Windows 2000 because they check to make sure that a specific version of Windows is running. This is especially true for a lot of applications designed to run under Windows 95. When Windows 95 was released, many developers included checks to make sure that the application was being run under Windows 95, as opposed to Windows 3.x. Many of these checks never anticipated future versions of Windows, and therefore, if any operating system other than Windows 95 is detected, the application won’t run. You can use the Application Compatibility Tool to fix the problem by specifying the operating system that the application is looking for.

Check box definitions
After the operating system section, there are four check boxes that you can use to correct common compatibility problems.

Disable Heap Manager On Windows 2000
One of the biggest problems with running older applications in Windows 2000 is that Windows 2000 uses memory differently than previous versions of Windows. Because of this, it’s possible to receive memory-related errors when running an application that you never saw under the old operating system. If you see these types of errors, you should select the Disable Heap Manager On Windows 2000 check box. Disabling the heap manager usually gets rid of these errors. Unfortunately, it also means that Windows won’t use memory as efficiently, so using this switch may result in a slight drop in overall system performance.

Use Pre Windows 2000 Temp Path
Lots of applications still rely on temporary files. The problem is that many older applications either hard code C:\Temp as the temporary files’ location, or they impose a limit to the number of characters that can be used in the path to the temp directory. If you encounter such a problem, you can easily fix it by selecting the Use Pre Windows 2000 Temp Path check box. This check box tells the Application Compatibility Tool to trick the application into thinking that all temp files should be placed in C:\Temp. If C:\Temp doesn’t exist on your system, then the utility will create it for you.

Correct Disk Space Detection For 2 GB+ Drives
There was a time, many moons ago, when a hard disk partition couldn’t exceed 2 GB in size. Thus an older application that checks the amount of free disk space often lacks the necessary code for disks with over 2 GB of space. When an application encounters a situation like this, the free disk space is often calculated incorrectly, and a PC with 70 GB of free disk space might appear insufficient to the application. Checking the Correct Disk Space For 2 GB+ Drives check box fixes this problem and allows your older application to interact with today’s jumbo hard drives.

Make The Above Check Box Settings Permanent
If you find that specific settings within the Application Compatibility Tool allow a legacy application to run, then you probably don’t want to have to use the Application Compatibility Tool every time you use the application. Instead, you can use the tool to “fix” the application. To do so, simply select the required options and then select the Make The Above Check Box Settings Permanent check box. All of the other options that you’ve chosen will be written to the system registry. When you run the legacy application, all of the necessary compatibility tweaks will be automatically set, and you won’t have to open the Application Compatibility Tool. The tool will run in the background, completely out of sight.

Command-line mode
While it’s easiest to run the Application Compatibility Tool in GUI mode, you can use the tool from a command prompt if, for some reason, the application requires it. To do so, open a command prompt window and navigate to the \Program Files\Support Tools folder. Next, enter the Dir Apcompat.exe command to verify that this is the location for the Apcompat.exe file. When you’ve located the necessary file, you can enter the Apcompat command by using the following syntax:
APCOMPAT [-?] [-V version name] [-X program path] [-D] [-T] [-G] [-K]

Unlike some command-line utilities that I’ve seen, the switches used by Apcompat.exe are fairly simple to use. As you’ve no doubt guessed, the -? switch tells the utility that you need help. The -V switch tells the utility that you want to trick the application into thinking that it’s running under a specific version of Windows. You must follow the -V switch with a version code. These codes are as follows:
1 – Windows NT 4.0 SP3
2 – Windows NT 4.0 SP4
3 – Windows NT 4.0 SP5
4 – Windows 98
5 – Windows 95

You use the -X switch to specify the path and executable file name for the program that needs to run. For example, you might follow the -X switch with something like C:\folder\program.exe. Whatever the path, you must specify the filename, or the command will fail. Another useful switch is -D, which disables the heap manager for portions of memory reserved for the specific program. The -T switch tells the Apcompat.exe file to use the \Temp folder when running the program. The -G switch corrects the disk space detection issues for larger hard disks, and the -K switch tells Apcompat.exe to permanently associate the switches that you’ve specified with the application.

For more information on application compatibility
If you’d like to know more about application compatibility issues and the products available to help you deal with them, check out these other TechProGuild articles:

Editor's Picks

Free Newsletters, In your Inbox