Type and Creator codes are an integral part of Mac OS life.
Every file in the Macintosh universe (Mac OS Classic, anyway) has a four character type code and a similar creator code, both composed of printable characters, along with other metadata which comes into the picture later. These codes determine the icon used to represent the file in the Finder, file dialogs, and menus. They also affect what happens when a non-executable is opened in the Finder.
Documents
Whenever you double-click on a non-executable in the Finder, the Finder tries to open it with an application that has the same creator code as the document being opened. If you're having problems, rebuild your desktop.
Icons
The simplest way to control the icon of a particular file is to make custom icon. That is, paste your picture into the icon section of that file's Get Info window.
However, what if you are developing a new program and you want its documents to use your icons by default? It's not such a big problem is you have ResEdit handy. You will create a bundle (resource type BNDL) of FREF resources. It's easy.
First, you'll want to make up your icons into the proper resources (types ICN8, ICN4, and ICN# for large icons; ics8, ics4, and icn# for small icons; and icns for those fancy new color icons from Mac OS 8.5 (ResEdit doesn't have an editor for these, I'm afraid). Make sure they're all the same resource id.
Next, use ResEdit to make a new resource of type BNDL. Give the new resource id number 128. In the editor, type in your new application's creator code in the field titled "Signature". Then, select "Create New File Type" from the Resource menu. Enter the type code of your desired file. You must now edit the new FREF resource that has just been created. These will be created sequentially starting from id 128. Put the resource id of the icons you wish to be associated with your documents in the Icon localID field.
Do this for all the document types you want. When you have finished, use the Get Info on open file command from the File menu. Make sure the "Has BNDL" flag is checked. You may need to rebuild your desktop for these steps to take effect.