Home
Page
Doing
Windows
Windows Tips Categories
|
Windows Explorer
Tips
CREATING A NEW FILE TYPE
As mentioned in a previous column, Windows is
"document-centric", and one of the implications
of this is that in Explorer you can click on a file which
is really a data file (called a document) and that starts
up the program that is associated with that type of file.
The different file types are differentiated by the file
extension. For example, files with the extension
".TXT" are normally assumed to be straight
ASCII text, and the standard application program handling
them is Windows NotePad. Files with the extension
".DOC" are assumed to be Microsoft Word
documents, so if you have that program, it will be used
to process them. ".BMP" files are presumed to
be Windows bitmap graphics, and Windows Paint will handle
them.
The list of all file types that are known to Windows to
be associated with a standard program can be accessed in
this manner: first, start up Explorer. Click on the View
menu in Win95 or the Tools menu in Win98/ME. Choose the
Options (or Folder Options) entry on this menu. Now click
on the File Types tab.

Let us suppose you wanted to create a new file type of
".DIZ", which is a straight ASCII documentation
file that you will find in most (if not all) of the
ZIPped files you download from the BBS. This file type,
since it is straight ASCII, can be read by NotePad. So,
in the Options dialog box you have just opened, click on
the button "New Type..." and you will now open
up an "Add New File Type" dialog box. Type in
some sort of description for the new file type, such as
"DIZ file", and the Associated extension
("DIZ".)
Now you need to add one or more actions that can be
performed on this file and specify how Windows is to do
it. So click on the "New" button below the
Actions box, and you will bring up the New Action dialog
box. As the "Action" entry, type
"Open", and for the "Application to
perform action" type in
"C:\Windows\Notepad.exe". To complete adding
this action, click the OK button. You could also define
an action called "Print" in a similar way. In
this case what you would type for the "Application
to perform action" would be
"C:\Windows\Notepad.exe /p". (The /p at the end
passes a parameter to the Notepad program telling it to
print the input file.)
After you've defined the last action you want to
associate with the .DIZ file type, click the OK button.
Now, if you double-click on a file with a
".DIZ" extension in Explorer, NotePad will
immediately start up to display it to your screen.
Another way of getting this to happen is to right-click
on the .DIZ file, and the context menu that comes up will
show your "Open" and "Print" actions,
which can then be clicked on to do whichever you want.
|