Have you ever been extension-jacked? It’s happened to many of us. You have a favorite program that you use almost every day. One day, you install an unrelated program and it takes over the file extensions that were registered by the other program. Now, when you double-click a file that was created by your other program, the new program launches and tries (usually unsuccessfully) to open the file. Fortunately, there are some ways to fight back when this situation happens to you. In this Daily Drill Down, I’ll explain some techniques that you can use in a Windows 98 environment to restore file associations that have been taken over by a rogue program.

What are file extensions?
File extensions are the three characters preceded by a period at the end of a file name, such as .txt, .doc, or .exe. Windows associates certain actions or programs with these extensions. For example, if you double-click an .exe file, Windows will assume that it’s an executable program and attempt to load it, but if you double-click a .txt file, Windows will display the file in Notepad.

Before we begin
Before I get started, there are several things that I should point out. Although one of the techniques that I’ll share with you is simple to use, the other techniques aren’t for the faint of heart. You shouldn’t attempt these other techniques unless you have a good understanding of the Windows 98 file system and are comfortable with the idea of working with the registry. As you probably know, working with the registry can be dangerous. Making a mistake in the registry can destroy Windows 98, your application programs, or both. Therefore, if you do decide to repair an extension yourself, please make sure that you have a good backup of your system just in case something goes wrong.

A simple repair
Usually, only a poorly written program will hijack a previously registered file extension without warning you. If you’ve had an extension hijacked, there’s a good chance that the culprit was a shareware or other low-budget program. If the program that previously held the extension was a good-quality commercial program, then the solution to your problem may be as simple as checking your program options or properties. You may find a menu choice that offers to associate file types to that program. If you find such an option, you’re back in business. Problem solved.

If no option exists, you can try reinstalling the program that previously held the extension. Often, the Setup program detects where the file extensions it wants to use are registered and will ask you if you want to change the extension to be associated with the program that you’re installing.

A more complicated repair
Unfortunately, reinstalling the original program doesn’t always work. Sometimes you have to revert to directly manipulating Windows. There are a couple of different ways of doing this. One method involves using Windows Explorer, while the other method involves using the Registry Editor. The differences are that the Windows Explorer method is safer and easier. However, there are a few things that you can do through the Registry Editor that you can’t do through Windows Explorer.

Using Windows Explorer to repair associations
Before attempting to correct the problem using the Registry Editor, I recommend trying to correct the problem through Windows Explorer. To do so, open Windows Explorer and select the Folder Options command from the View menu. When you do, you’ll see the Folder Options properties sheet. Next, select the File Types tab.

Listing file extensions
As shown in Figure A, the File Types tab contains a list of most of the registered file extensions and their corresponding programs. If you’re trying to repair one particular registered file extension, the tricky part can be locating it, since the list is organized by program as well as by extension.

For this technique, it’s necessary to browse through the programs on the list until you find the one that hijacked the file extension that you’re trying to repair. To make matters more difficult, sometimes the program will show a different name on the list than it does on the Start menu. If you’re having difficulty locating the program that hijacked the registered file extension, then you have two choices. You may either look at each program on the list so that you can see exactly which extensions that program has registered, or you can use the registry repair method that I’ll discuss next month in the second part of this series.

Figure A
The File Types tab contains a list of most of the programs and their registered extensions.

Editing file extensions
Once you’ve located the guilty program, you have some choices to make. If you select the program and click the Edit button, you’ll see an Edit File Type dialog box, similar to the one shown in Figure B. The first thing that you should check on this dialog box is the Default Extension For Content Type drop-down list. If only one extension is present on this list, then you have nothing to worry about—the repair will be easy. If there are multiple extensions, you’ll be forced to use the registry to make the repair.

Figure B
The Edit File Type dialog box allows you to control the behavior of most registered file extensions.

By looking at Figure B, you can see that the Edit File Type dialog box contains a set of buttons marked New, Edit, Remove, and Set As Default. These buttons affect the behavior of the file type’s context menus. Just in case you’re unfamiliar with context menus, a context menu is the menu that you see when you right-click a file. The reason that it’s called a context menu is that the commands present on the menu differ depending on what type of file you’ve clicked on. For example, if you right-click an audio file, the menu may have a Play command (depending on what audio software has been installed on your machine). While a Play command would be suitable for an audio file, it wouldn’t make any sense to have one on a spreadsheet’s context menu. Therefore, the context menu’s commands and the function of those commands are specific to the individual file types.

The New, Edit, Remove, and Set As Default buttons allow you to add, edit, or remove context menu commands from the file extension. For example, in Figure C, you can see the command associated with a bitmap file’s Open action. Also in Figure C, you can see that unless the command is set to use DDE, the command is often merely a pointer to the executable file, followed by a variable such as %1. It’s often possible to simply edit these commands to point to a different program. The command shown in Figure C will launch the Paint program, and then try to open the .bmp file that was clicked on. However, you could easily change the command to point to another program. For example, if you wanted Notepad to attempt to open the file, you could change the command to C:\PROGRA~1\ACCESS~1\NOTEPAD” “%1. Of course in real life, you wouldn’t want to make this change because Notepad can’t open a BMP file, but you get the idea of how the command works.

Figure C
The Editing Action For Type dialog box allows you to control the behavior of specific context menu commands.

If you return to the main Edit File Type screen, shown in Figure B, you’ll notice that there are no buttons for removing a single registered file type from the list of registered file extensions. This means that you have some choices to make. If multiple extensions are registered, and you need to keep all but one of them, you’ll absolutely have to use the registry to complete the repair. However, if the program registers only a single file type, you can complete the process from within Windows Explorer. To do this, click the Cancel button to return to the File Types tab. Now, select the program that has hijacked the image and click the Remove button. When you do, you’ll see a warning message that indicates that if you remove a registered file type, you’ll no longer be able to open files that are normally associated with the program by double-clicking them. The dialog box will then ask if you’re sure that you want to remove the association. Click Yes, and the extension will be free. Once you’ve done so, you have to make the original program recognize the extension again.

Adding file extensions to associate to a program
As I mentioned earlier, there’s no way to add an extension to the drop-down list of a program that already appears on the File Types list unless you do so through the registry.

This means that unless you want to use the Registry Editor, you’ll have to create a brand new file type entry. To do this without using the registry, find an entry for the program you want to associate a new extension with. If you find one, write down all of the context menu commands and their syntax. You can use this information to construct a file association.

While you’re on this screen, check to see if the original program entry has any extensions associated with it. If there are presently no extensions, you can simply delete the reference to the program and reconstruct it using the method that I’ll discuss in a minute. However, don’t delete the program until you’ve read this entire Daily Drill Down. If you can’t locate a reference to the program, it’s not that big a deal. You can usually rip off the commands from just about any program that doesn’t use DDE in its context menu commands. You’re usually pretty safe using programs like Notepad or Paint as a model. However, you wouldn’t want to use Microsoft Word or Excel as your model, because all of the programs in the Microsoft Office program suite depend heavily on the use of DDE.

Just in case you’re wondering, DDE stands for Dynamic Data Exchange. DDE is a format that allows applications to exchange data. For example, you can link an Excel spreadsheet into a Microsoft Word document. If you make a change to the spreadsheet, the change will also appear in the Word document because of the way that the documents are linked.

At this point, it’s time to re-link the extension to its original program. The method for doing so is the same whether you deleted the program’s original entry or not. The only difference is that if you still have the original entry, you’ll have to come up with a unique name for the new entry. For example, if your original program entry was Bitmap File, you couldn’t call the new entry Bitmap File, too. You might call it Bitmap File Patch or something like that.

Using the New Type button
With that said, return to the File Types tab and click the New Type button. When you do, you’ll see the Add New File Type dialog box. Enter the new name that you’ve chosen into the Description Of Type field. Next, enter the extension that you want to register in the Associated Extension field. You can now add Mime content or change the icon if you want, but these steps aren’t necessary. You will have to assign some actions to the registered type, though. Otherwise, Windows will know that it’s supposed to do something with the extension, but it won’t know what that something is. You can add the actions by clicking the New button. Depending on what type of file you’re registering, the most common actions are usually Open and Print. You should almost always have an Open command unless you have a really good reason not to. The Open command should also be the default action. The default command is the command that’s executed when you double-click an icon of the type that you’re setting up. Therefore, if you set the default action to open, then when you double-click an icon, Windows will load the associated program and try to use it to open the file that you just double-clicked. The default action is the one listed in bold type. If you’ve accidentally made some other action the default, you can correct the problem by selecting the Open command and clicking the Set Default button. You can see an example of what a competed Add New File Type function might look like in Figure D.

Figure D
The Add New File Type dialog box can be used to register a new file extension.

The registry
As I mentioned, you can do things through the registry that you can’t do through Windows Explorer. This includes removing a single associated extension from a program that has multiple extensions registered. Likewise, you can add an extension to an existing program without having to completely rewrite the entire entry. I’ll explain the techniques for doing all of this and more in the second part of this series, next month.

Fix those troubling associations
When a newly installed program registers itself to use file extensions that are already in use, it can be a nuisance, and it can also cause problems. In this Daily Drill Down, I’ve explained some techniques that you can use to restore the file extension to the program that originally registered it.

Talainia Posey learned to handle PCs the old fashioned way: by reading manuals and doing on-the-job troubleshooting. Her experience also includes installing networks for several small companies. When she’s not working on computers, Talainia loves to shop for toys and watch cartoons, or spend time with her cat, Beavis.

The authors and editors have taken care in preparation of the content contained herein, but make no expressed or implied warranty of any kind and assume no responsibility for errors or omissions. No liability is assumed for any damages. Always have a verified backup before making any changes.

Subscribe to the Microsoft Weekly Newsletter

Be your company's Microsoft insider by reading these Windows and Office tips, tricks, and cheat sheets. Delivered Mondays and Wednesdays

Subscribe to the Microsoft Weekly Newsletter

Be your company's Microsoft insider by reading these Windows and Office tips, tricks, and cheat sheets. Delivered Mondays and Wednesdays