Site hosted by Angelfire.com: Build your free website today!
Chapter 3: Installing Programs

PreviousChapterContentsGlossaryNext

Associating a Program with a File Extension

Many programs create, edit, or display files of a specific type. For example, the Notepad program (a text editor that comes with Windows) works with text files that usually have the filename extension .txt (the extension is the part of the filename that follows the last dot in the filename). When you open a file with the extension .txt, Windows knows to run Notepad.

The Windows Registry stores file associations, information about which program you use to edit each type of file. Installation programs usually store this information in the Registry, but you can, too. Chapter 38 describes how to view and edit the Registry with the Registry Editor program, but you can use other tools to change your file associations.

Windows offers three ways to create or change a file association: the Open With dialog box, the Folder Options dialog box, and the Edit File Types dialog box. The third method is rarely used.

Associating Files with Programs when Opening a File

In an Explorer window, you can tell Windows which program to use when opening files with a particular extension. Follow these steps:

  1. In an Explorer window, find a file with the extension that you want to associate with a program.
  2. Right-click the filename and choose Open With from the menu that appears. (If Open With doesn't appear on the menu, you have to use another method of associating the file type with the program; see the next section.) You see the Open With dialog box shown in Figure 3-3. (If a small submenu of programs appears, select Choose Program to display the Open With dialog box.)
[figure]
Figure 3-3: Which program do you want run to open this file (and files like it)?
  1. Select the program to run, or click Browse to find the program file.
  2. Click the Always Use The Selected Program To Open This Kind Of File check box and click OK.

Windows Explorer permanently saves the association of the filename extension with the program, and it opens the file you selected with the program you specified.

Associating Files with Programs by Using Folder Options

Another way to associate a file type (file extension) with a program (or change the program associated with a file type) is to use the File Types tab on the Folder Options dialog box.

Editing an Existing Association

To edit a file association, follow these steps:

  1. Choose Start | Control Panel, click Appearance And Themes, and run Folder Options. You see the Folder Options dialog box. (You can also display this dialog box by choosing Tools | Folder Options from any Explorer window.)
  2. Click the File Types tab, shown in Figure 3-4.
[figure]
Figure 3-4: The Folder Options dialog box with the File Types tab selected
  1. In the Registered File Types list, click the type of file you want to associate with a program. (Scroll down the list--it's long.) When you select a file type, more information about that file type appears in the Details For File Type box. You also see two buttons: Change (to associate one program with the file type) and Advanced (to associate multiple programs with the file type).
  2. To see or change which program Windows runs to open this type of file, click Change. You see the Open With dialog box (see Figure 3-3). Select the program to run or click the Click Here link (in "If the program is not in the list, click here") to find the program file. Then click OK.
  3. Close the Open With and Folder Options dialog boxes.

Windows now knows to run the program you specified when you open a file of this type.

Creating a New Association

You can create a new file type, with a new extension.

  1. Choose Start | Control Panel, click Appearance And Themes, run Folder Options, and click the File Types tab (see Figure 3-4).
  2. If the file extension doesn't appear in the list of Registered Files Types, click New to display the Create New Extension dialog box, shown here:

[image]
  1. Type the extension in the File Extension box.
  2. If you know the Windows file type (that is, the name of the Windows class or object that this file extension contains), click Advanced to expand the Create New Extension dialog box to include the Associated File Type list. Choose the file type from the (very long) list.
  3. Click OK. Windows adds the new type at the top of the list (not in alphabetical order, unless you close and reopen the dialog box).
  4. Select the program to associate with this new extension by following the steps in the previous section.

Editing a File Association

Rather than telling Windows that one program can handle a file type, you can specify different programs for different actions. You rarely need to do this: installation programs use this facility when registering a new program to handle file types; human beings almost never need to change the details of file type association.

Displaying the Edit File Types Dialog Box

Follow these steps to specify the settings for a file type:

  1. Choose Start | Control Panel, click Appearance And Themes, run Folder Options, and click the File Types tab (see Figure 3-4).
  2. Choose a file type from the Registered File Types list.
  3. Click the Advanced button. You see the Edit File Type dialog box, shown in Figure 3-5. It displays the information that the Registry knows about this file type, including the icon to use for files of this type and a description of the file type. The Actions box lists the tasks that Windows knows how to perform for files of this type: open, print, edit, and other actions. For each action, you can tell Windows which program to use; for example, you can use Internet Explorer to display .gif files, but use Paint Shop Pro to edit and print them.
[figure]
Figure 3-5: Specifying which programs open and print one file type
  1. To change which icon appears for this type of file, click the Change Icon button. Windows displays the available icons. Click one and click OK.
  2. To see the details of what Windows does when you choose a command like Open or Print from a shortcut menu for a type of file, choose the action from the Actions list and click the Edit button. You see the Editing Action For Type dialog box (Figure 3-6). For information about the entries in this dialog box, see the next section. Click OK when you have finished.
[figure]
Figure 3-6: DDE messages let you control exactly how Windows handles each file type.
  1. Click any of the three settings that appear on the Edit File Type dialog box, if you want to change their settings:
  1. Click OK to store your changes to the way that Windows handles files of this type.

Actions and DDE Messages Associated with File Types

In addition to telling Windows which program to run for each file type, you can define as many actions for a file type as you want. For example, you can define one action that opens files of that type and another action that prints files. There are two types of actions:

tip Specifying regular actions is useful if you use two programs with files of one file type--for example, you might use your browser to view HTML files, but your Web page editor to create and edit those files. Associate one program with the file type. Add the second program to the actions for that file type. Single- or double-clicking a file of that type runs the first program. To run the second program, right-click the file and choose the program from the shortcut menu.

In the Edit File Type dialog box, you choose an action and click Edit to see the Editing Action For Type dialog box (Figure 3-6)). The Application Used To Perform Action box contains the command line Windows executes when you open files of this type. The command line usually consists of the full pathname of a program, possibly followed by a space and %1. The %1 represents the name of the file you want to open; that is, this command runs the program and tells the program to open the file you double-clicked.

If the Use DDE check box is not selected, it is a regular action (that is, a command that appears on the shortcut menu, which appears when you right-click a file of this type). In this case, the dialog box has only two settings:

If the Use DDE check box is selected, the action is a DDE action, and you see four additional settings:

PreviousChapterContentsGlossaryNext